diff options
Diffstat (limited to 'src/Wallabag')
26 files changed, 43 insertions, 43 deletions
diff --git a/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php b/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php index 8d7b6ee9..f3090e65 100644 --- a/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php +++ b/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php | |||
@@ -31,7 +31,7 @@ class WallabagAnnotationController extends FOSRestController | |||
31 | $total = count($annotationRows); | 31 | $total = count($annotationRows); |
32 | $annotations = ['total' => $total, 'rows' => $annotationRows]; | 32 | $annotations = ['total' => $total, 'rows' => $annotationRows]; |
33 | 33 | ||
34 | $json = $this->get('serializer')->serialize($annotations, 'json'); | 34 | $json = $this->get('jms_serializer')->serialize($annotations, 'json'); |
35 | 35 | ||
36 | return (new JsonResponse())->setJson($json); | 36 | return (new JsonResponse())->setJson($json); |
37 | } | 37 | } |
@@ -64,7 +64,7 @@ class WallabagAnnotationController extends FOSRestController | |||
64 | $em->persist($annotation); | 64 | $em->persist($annotation); |
65 | $em->flush(); | 65 | $em->flush(); |
66 | 66 | ||
67 | $json = $this->get('serializer')->serialize($annotation, 'json'); | 67 | $json = $this->get('jms_serializer')->serialize($annotation, 'json'); |
68 | 68 | ||
69 | return JsonResponse::fromJsonString($json); | 69 | return JsonResponse::fromJsonString($json); |
70 | } | 70 | } |
@@ -99,7 +99,7 @@ class WallabagAnnotationController extends FOSRestController | |||
99 | $em->persist($annotation); | 99 | $em->persist($annotation); |
100 | $em->flush(); | 100 | $em->flush(); |
101 | 101 | ||
102 | $json = $this->get('serializer')->serialize($annotation, 'json'); | 102 | $json = $this->get('jms_serializer')->serialize($annotation, 'json'); |
103 | 103 | ||
104 | return JsonResponse::fromJsonString($json); | 104 | return JsonResponse::fromJsonString($json); |
105 | } | 105 | } |
@@ -124,7 +124,7 @@ class WallabagAnnotationController extends FOSRestController | |||
124 | $em->remove($annotation); | 124 | $em->remove($annotation); |
125 | $em->flush(); | 125 | $em->flush(); |
126 | 126 | ||
127 | $json = $this->get('serializer')->serialize($annotation, 'json'); | 127 | $json = $this->get('jms_serializer')->serialize($annotation, 'json'); |
128 | 128 | ||
129 | return (new JsonResponse())->setJson($json); | 129 | return (new JsonResponse())->setJson($json); |
130 | } | 130 | } |
diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php index 6db97731..86e72335 100644 --- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php +++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php | |||
@@ -752,7 +752,7 @@ class EntryRestController extends WallabagRestController | |||
752 | $context = new SerializationContext(); | 752 | $context = new SerializationContext(); |
753 | $context->setSerializeNull(true); | 753 | $context->setSerializeNull(true); |
754 | 754 | ||
755 | $json = $this->get('serializer')->serialize($data, 'json', $context); | 755 | $json = $this->get('jms_serializer')->serialize($data, 'json', $context); |
756 | 756 | ||
757 | return (new JsonResponse())->setJson($json); | 757 | return (new JsonResponse())->setJson($json); |
758 | } | 758 | } |
diff --git a/src/Wallabag/ApiBundle/Controller/TagRestController.php b/src/Wallabag/ApiBundle/Controller/TagRestController.php index efa4e8cf..9d333fe4 100644 --- a/src/Wallabag/ApiBundle/Controller/TagRestController.php +++ b/src/Wallabag/ApiBundle/Controller/TagRestController.php | |||
@@ -25,7 +25,7 @@ class TagRestController extends WallabagRestController | |||
25 | ->getRepository('WallabagCoreBundle:Tag') | 25 | ->getRepository('WallabagCoreBundle:Tag') |
26 | ->findAllTags($this->getUser()->getId()); | 26 | ->findAllTags($this->getUser()->getId()); |
27 | 27 | ||
28 | $json = $this->get('serializer')->serialize($tags, 'json'); | 28 | $json = $this->get('jms_serializer')->serialize($tags, 'json'); |
29 | 29 | ||
30 | return (new JsonResponse())->setJson($json); | 30 | return (new JsonResponse())->setJson($json); |
31 | } | 31 | } |
@@ -58,7 +58,7 @@ class TagRestController extends WallabagRestController | |||
58 | 58 | ||
59 | $this->cleanOrphanTag($tag); | 59 | $this->cleanOrphanTag($tag); |
60 | 60 | ||
61 | $json = $this->get('serializer')->serialize($tag, 'json'); | 61 | $json = $this->get('jms_serializer')->serialize($tag, 'json'); |
62 | 62 | ||
63 | return (new JsonResponse())->setJson($json); | 63 | return (new JsonResponse())->setJson($json); |
64 | } | 64 | } |
@@ -100,7 +100,7 @@ class TagRestController extends WallabagRestController | |||
100 | 100 | ||
101 | $this->cleanOrphanTag($tags); | 101 | $this->cleanOrphanTag($tags); |
102 | 102 | ||
103 | $json = $this->get('serializer')->serialize($tags, 'json'); | 103 | $json = $this->get('jms_serializer')->serialize($tags, 'json'); |
104 | 104 | ||
105 | return (new JsonResponse())->setJson($json); | 105 | return (new JsonResponse())->setJson($json); |
106 | } | 106 | } |
@@ -126,7 +126,7 @@ class TagRestController extends WallabagRestController | |||
126 | 126 | ||
127 | $this->cleanOrphanTag($tag); | 127 | $this->cleanOrphanTag($tag); |
128 | 128 | ||
129 | $json = $this->get('serializer')->serialize($tag, 'json'); | 129 | $json = $this->get('jms_serializer')->serialize($tag, 'json'); |
130 | 130 | ||
131 | return (new JsonResponse())->setJson($json); | 131 | return (new JsonResponse())->setJson($json); |
132 | } | 132 | } |
@@ -145,7 +145,7 @@ class TagRestController extends WallabagRestController | |||
145 | $em = $this->getDoctrine()->getManager(); | 145 | $em = $this->getDoctrine()->getManager(); |
146 | 146 | ||
147 | foreach ($tags as $tag) { | 147 | foreach ($tags as $tag) { |
148 | if (count($tag->getEntries()) === 0) { | 148 | if (0 === count($tag->getEntries())) { |
149 | $em->remove($tag); | 149 | $em->remove($tag); |
150 | } | 150 | } |
151 | } | 151 | } |
diff --git a/src/Wallabag/ApiBundle/Controller/UserRestController.php b/src/Wallabag/ApiBundle/Controller/UserRestController.php index 6f47cff0..a1378fc5 100644 --- a/src/Wallabag/ApiBundle/Controller/UserRestController.php +++ b/src/Wallabag/ApiBundle/Controller/UserRestController.php | |||
@@ -46,7 +46,7 @@ class UserRestController extends WallabagRestController | |||
46 | public function putUserAction(Request $request) | 46 | public function putUserAction(Request $request) |
47 | { | 47 | { |
48 | if (!$this->getParameter('fosuser_registration') || !$this->get('craue_config')->get('api_user_registration')) { | 48 | if (!$this->getParameter('fosuser_registration') || !$this->get('craue_config')->get('api_user_registration')) { |
49 | $json = $this->get('serializer')->serialize(['error' => "Server doesn't allow registrations"], 'json'); | 49 | $json = $this->get('jms_serializer')->serialize(['error' => "Server doesn't allow registrations"], 'json'); |
50 | 50 | ||
51 | return (new JsonResponse()) | 51 | return (new JsonResponse()) |
52 | ->setJson($json) | 52 | ->setJson($json) |
@@ -92,7 +92,7 @@ class UserRestController extends WallabagRestController | |||
92 | $errors['password'] = $this->translateErrors($data['plainPassword']['children']['first']['errors']); | 92 | $errors['password'] = $this->translateErrors($data['plainPassword']['children']['first']['errors']); |
93 | } | 93 | } |
94 | 94 | ||
95 | $json = $this->get('serializer')->serialize(['error' => $errors], 'json'); | 95 | $json = $this->get('jms_serializer')->serialize(['error' => $errors], 'json'); |
96 | 96 | ||
97 | return (new JsonResponse()) | 97 | return (new JsonResponse()) |
98 | ->setJson($json) | 98 | ->setJson($json) |
@@ -127,7 +127,7 @@ class UserRestController extends WallabagRestController | |||
127 | */ | 127 | */ |
128 | private function sendUser(User $user, $group = 'user_api', $status = JsonResponse::HTTP_OK) | 128 | private function sendUser(User $user, $group = 'user_api', $status = JsonResponse::HTTP_OK) |
129 | { | 129 | { |
130 | $json = $this->get('serializer')->serialize( | 130 | $json = $this->get('jms_serializer')->serialize( |
131 | $user, | 131 | $user, |
132 | 'json', | 132 | 'json', |
133 | SerializationContext::create()->setGroups([$group]) | 133 | SerializationContext::create()->setGroups([$group]) |
diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php index 71da2a64..7d8cfbba 100644 --- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php +++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php | |||
@@ -19,7 +19,7 @@ class WallabagRestController extends FOSRestController | |||
19 | public function getVersionAction() | 19 | public function getVersionAction() |
20 | { | 20 | { |
21 | $version = $this->container->getParameter('wallabag_core.version'); | 21 | $version = $this->container->getParameter('wallabag_core.version'); |
22 | $json = $this->get('serializer')->serialize($version, 'json'); | 22 | $json = $this->get('jms_serializer')->serialize($version, 'json'); |
23 | 23 | ||
24 | return (new JsonResponse())->setJson($json); | 24 | return (new JsonResponse())->setJson($json); |
25 | } | 25 | } |
diff --git a/src/Wallabag/CoreBundle/Command/ListUserCommand.php b/src/Wallabag/CoreBundle/Command/ListUserCommand.php index 20660d18..68e515da 100644 --- a/src/Wallabag/CoreBundle/Command/ListUserCommand.php +++ b/src/Wallabag/CoreBundle/Command/ListUserCommand.php | |||
@@ -52,7 +52,7 @@ class ListUserCommand extends ContainerAwareCommand | |||
52 | '%s/%s%s user(s) displayed.', | 52 | '%s/%s%s user(s) displayed.', |
53 | count($users), | 53 | count($users), |
54 | $nbUsers, | 54 | $nbUsers, |
55 | $input->getArgument('search') === null ? '' : ' (filtered)' | 55 | null === $input->getArgument('search') ? '' : ' (filtered)' |
56 | ) | 56 | ) |
57 | ); | 57 | ); |
58 | 58 | ||
diff --git a/src/Wallabag/CoreBundle/Command/ShowUserCommand.php b/src/Wallabag/CoreBundle/Command/ShowUserCommand.php index 2dca32c4..a0184267 100644 --- a/src/Wallabag/CoreBundle/Command/ShowUserCommand.php +++ b/src/Wallabag/CoreBundle/Command/ShowUserCommand.php | |||
@@ -56,7 +56,7 @@ class ShowUserCommand extends ContainerAwareCommand | |||
56 | sprintf('Email: %s', $user->getEmail()), | 56 | sprintf('Email: %s', $user->getEmail()), |
57 | sprintf('Display name: %s', $user->getName()), | 57 | sprintf('Display name: %s', $user->getName()), |
58 | sprintf('Creation date: %s', $user->getCreatedAt()->format('Y-m-d H:i:s')), | 58 | sprintf('Creation date: %s', $user->getCreatedAt()->format('Y-m-d H:i:s')), |
59 | sprintf('Last login: %s', $user->getLastLogin() !== null ? $user->getLastLogin()->format('Y-m-d H:i:s') : 'never'), | 59 | sprintf('Last login: %s', null !== $user->getLastLogin() ? $user->getLastLogin()->format('Y-m-d H:i:s') : 'never'), |
60 | sprintf('2FA activated: %s', $user->isTwoFactorAuthentication() ? 'yes' : 'no'), | 60 | sprintf('2FA activated: %s', $user->isTwoFactorAuthentication() ? 'yes' : 'no'), |
61 | ]); | 61 | ]); |
62 | } | 62 | } |
diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index 7e39992d..a89bb780 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php | |||
@@ -348,7 +348,7 @@ class ConfigController extends Controller | |||
348 | $em = $this->getDoctrine()->getManager(); | 348 | $em = $this->getDoctrine()->getManager(); |
349 | 349 | ||
350 | foreach ($tags as $tag) { | 350 | foreach ($tags as $tag) { |
351 | if (count($tag->getEntries()) === 0) { | 351 | if (0 === count($tag->getEntries())) { |
352 | $em->remove($tag); | 352 | $em->remove($tag); |
353 | } | 353 | } |
354 | } | 354 | } |
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index b0b74c38..840dc254 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php | |||
@@ -195,7 +195,7 @@ class EntryController extends Controller | |||
195 | public function showUnreadAction(Request $request, $page) | 195 | public function showUnreadAction(Request $request, $page) |
196 | { | 196 | { |
197 | // load the quickstart if no entry in database | 197 | // load the quickstart if no entry in database |
198 | if ((int) $page === 1 && $this->get('wallabag_core.entry_repository')->countAllEntriesByUser($this->getUser()->getId()) === 0) { | 198 | if (1 === (int) $page && 0 === $this->get('wallabag_core.entry_repository')->countAllEntriesByUser($this->getUser()->getId())) { |
199 | return $this->redirect($this->generateUrl('quickstart')); | 199 | return $this->redirect($this->generateUrl('quickstart')); |
200 | } | 200 | } |
201 | 201 | ||
diff --git a/src/Wallabag/CoreBundle/Controller/ExportController.php b/src/Wallabag/CoreBundle/Controller/ExportController.php index 35a22046..7ca89239 100644 --- a/src/Wallabag/CoreBundle/Controller/ExportController.php +++ b/src/Wallabag/CoreBundle/Controller/ExportController.php | |||
@@ -59,7 +59,7 @@ class ExportController extends Controller | |||
59 | $methodBuilder = 'getBuilderFor' . $method . 'ByUser'; | 59 | $methodBuilder = 'getBuilderFor' . $method . 'ByUser'; |
60 | $repository = $this->get('wallabag_core.entry_repository'); | 60 | $repository = $this->get('wallabag_core.entry_repository'); |
61 | 61 | ||
62 | if ($category === 'tag_entries') { | 62 | if ('tag_entries' === $category) { |
63 | $tag = $this->get('wallabag_core.tag_repository')->findOneBySlug($request->query->get('tag')); | 63 | $tag = $this->get('wallabag_core.tag_repository')->findOneBySlug($request->query->get('tag')); |
64 | 64 | ||
65 | $entries = $repository->findAllByTagId( | 65 | $entries = $repository->findAllByTagId( |
diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php index be2dff98..616c37f2 100644 --- a/src/Wallabag/CoreBundle/Controller/TagController.php +++ b/src/Wallabag/CoreBundle/Controller/TagController.php | |||
@@ -65,7 +65,7 @@ class TagController extends Controller | |||
65 | $em->flush(); | 65 | $em->flush(); |
66 | 66 | ||
67 | // remove orphan tag in case no entries are associated to it | 67 | // remove orphan tag in case no entries are associated to it |
68 | if (count($tag->getEntries()) === 0) { | 68 | if (0 === count($tag->getEntries())) { |
69 | $em->remove($tag); | 69 | $em->remove($tag); |
70 | $em->flush(); | 70 | $em->flush(); |
71 | } | 71 | } |
diff --git a/src/Wallabag/CoreBundle/Event/Subscriber/TablePrefixSubscriber.php b/src/Wallabag/CoreBundle/Event/Subscriber/TablePrefixSubscriber.php index 35902654..fb8f225f 100644 --- a/src/Wallabag/CoreBundle/Event/Subscriber/TablePrefixSubscriber.php +++ b/src/Wallabag/CoreBundle/Event/Subscriber/TablePrefixSubscriber.php | |||
@@ -42,7 +42,7 @@ class TablePrefixSubscriber implements EventSubscriber | |||
42 | $classMetadata->setPrimaryTable(['name' => $this->prefix . $classMetadata->getTableName()]); | 42 | $classMetadata->setPrimaryTable(['name' => $this->prefix . $classMetadata->getTableName()]); |
43 | 43 | ||
44 | foreach ($classMetadata->getAssociationMappings() as $fieldName => $mapping) { | 44 | foreach ($classMetadata->getAssociationMappings() as $fieldName => $mapping) { |
45 | if ($mapping['type'] === ClassMetadataInfo::MANY_TO_MANY && isset($classMetadata->associationMappings[$fieldName]['joinTable']['name'])) { | 45 | if (ClassMetadataInfo::MANY_TO_MANY === $mapping['type'] && isset($classMetadata->associationMappings[$fieldName]['joinTable']['name'])) { |
46 | $mappedTableName = $classMetadata->associationMappings[$fieldName]['joinTable']['name']; | 46 | $mappedTableName = $classMetadata->associationMappings[$fieldName]['joinTable']['name']; |
47 | $classMetadata->associationMappings[$fieldName]['joinTable']['name'] = $this->prefix . $mappedTableName; | 47 | $classMetadata->associationMappings[$fieldName]['joinTable']['name'] = $this->prefix . $mappedTableName; |
48 | } | 48 | } |
diff --git a/src/Wallabag/CoreBundle/Form/DataTransformer/StringToListTransformer.php b/src/Wallabag/CoreBundle/Form/DataTransformer/StringToListTransformer.php index cb4bee83..57dbc95e 100644 --- a/src/Wallabag/CoreBundle/Form/DataTransformer/StringToListTransformer.php +++ b/src/Wallabag/CoreBundle/Form/DataTransformer/StringToListTransformer.php | |||
@@ -48,7 +48,7 @@ class StringToListTransformer implements DataTransformerInterface | |||
48 | */ | 48 | */ |
49 | public function reverseTransform($string) | 49 | public function reverseTransform($string) |
50 | { | 50 | { |
51 | if ($string === null) { | 51 | if (null === $string) { |
52 | return; | 52 | return; |
53 | } | 53 | } |
54 | 54 | ||
diff --git a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php index da19fe31..2c85da62 100644 --- a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php +++ b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php | |||
@@ -58,7 +58,7 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder | |||
58 | { | 58 | { |
59 | // required by credentials below | 59 | // required by credentials below |
60 | $host = strtolower($host); | 60 | $host = strtolower($host); |
61 | if (substr($host, 0, 4) === 'www.') { | 61 | if ('www.' === substr($host, 0, 4)) { |
62 | $host = substr($host, 4); | 62 | $host = substr($host, 4); |
63 | } | 63 | } |
64 | 64 | ||
@@ -113,7 +113,7 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder | |||
113 | 113 | ||
114 | $extraFields = []; | 114 | $extraFields = []; |
115 | foreach ($extraFieldsStrings as $extraField) { | 115 | foreach ($extraFieldsStrings as $extraField) { |
116 | if (strpos($extraField, '=') === false) { | 116 | if (false === strpos($extraField, '=')) { |
117 | continue; | 117 | continue; |
118 | } | 118 | } |
119 | 119 | ||
diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php index 1ac7ad83..854acb6a 100644 --- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php +++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php | |||
@@ -125,7 +125,7 @@ class ContentProxy | |||
125 | $date = $value; | 125 | $date = $value; |
126 | 126 | ||
127 | // is it a timestamp? | 127 | // is it a timestamp? |
128 | if (filter_var($date, FILTER_VALIDATE_INT) !== false) { | 128 | if (false !== filter_var($date, FILTER_VALIDATE_INT)) { |
129 | $date = '@' . $date; | 129 | $date = '@' . $date; |
130 | } | 130 | } |
131 | 131 | ||
diff --git a/src/Wallabag/CoreBundle/Operator/Doctrine/Matches.php b/src/Wallabag/CoreBundle/Operator/Doctrine/Matches.php index e6bb03b1..e1610161 100644 --- a/src/Wallabag/CoreBundle/Operator/Doctrine/Matches.php +++ b/src/Wallabag/CoreBundle/Operator/Doctrine/Matches.php | |||
@@ -16,7 +16,7 @@ class Matches | |||
16 | { | 16 | { |
17 | public function __invoke($subject, $pattern) | 17 | public function __invoke($subject, $pattern) |
18 | { | 18 | { |
19 | if ($pattern[0] === "'") { | 19 | if ("'" === $pattern[0]) { |
20 | $pattern = sprintf("'%%%s%%'", substr($pattern, 1, -1)); | 20 | $pattern = sprintf("'%%%s%%'", substr($pattern, 1, -1)); |
21 | } | 21 | } |
22 | 22 | ||
diff --git a/src/Wallabag/CoreBundle/Operator/Doctrine/NotMatches.php b/src/Wallabag/CoreBundle/Operator/Doctrine/NotMatches.php index b7f9da57..8e50f8d6 100644 --- a/src/Wallabag/CoreBundle/Operator/Doctrine/NotMatches.php +++ b/src/Wallabag/CoreBundle/Operator/Doctrine/NotMatches.php | |||
@@ -16,7 +16,7 @@ class NotMatches | |||
16 | { | 16 | { |
17 | public function __invoke($subject, $pattern) | 17 | public function __invoke($subject, $pattern) |
18 | { | 18 | { |
19 | if ($pattern[0] === "'") { | 19 | if ("'" === $pattern[0]) { |
20 | $pattern = sprintf("'%%%s%%'", substr($pattern, 1, -1)); | 20 | $pattern = sprintf("'%%%s%%'", substr($pattern, 1, -1)); |
21 | } | 21 | } |
22 | 22 | ||
diff --git a/src/Wallabag/CoreBundle/Operator/PHP/Matches.php b/src/Wallabag/CoreBundle/Operator/PHP/Matches.php index 987ed2a5..bc0c3f8f 100644 --- a/src/Wallabag/CoreBundle/Operator/PHP/Matches.php +++ b/src/Wallabag/CoreBundle/Operator/PHP/Matches.php | |||
@@ -16,6 +16,6 @@ class Matches | |||
16 | { | 16 | { |
17 | public function __invoke($subject, $pattern) | 17 | public function __invoke($subject, $pattern) |
18 | { | 18 | { |
19 | return stripos($subject, $pattern) !== false; | 19 | return false !== stripos($subject, $pattern); |
20 | } | 20 | } |
21 | } | 21 | } |
diff --git a/src/Wallabag/CoreBundle/Operator/PHP/NotMatches.php b/src/Wallabag/CoreBundle/Operator/PHP/NotMatches.php index 68b2676f..bd4d887a 100644 --- a/src/Wallabag/CoreBundle/Operator/PHP/NotMatches.php +++ b/src/Wallabag/CoreBundle/Operator/PHP/NotMatches.php | |||
@@ -16,6 +16,6 @@ class NotMatches | |||
16 | { | 16 | { |
17 | public function __invoke($subject, $pattern) | 17 | public function __invoke($subject, $pattern) |
18 | { | 18 | { |
19 | return stripos($subject, $pattern) === false; | 19 | return false === stripos($subject, $pattern); |
20 | } | 20 | } |
21 | } | 21 | } |
diff --git a/src/Wallabag/ImportBundle/Import/AbstractImport.php b/src/Wallabag/ImportBundle/Import/AbstractImport.php index cb46db09..58a234f4 100644 --- a/src/Wallabag/ImportBundle/Import/AbstractImport.php +++ b/src/Wallabag/ImportBundle/Import/AbstractImport.php | |||
@@ -165,7 +165,7 @@ abstract class AbstractImport implements ImportInterface | |||
165 | $entryToBeFlushed[] = $entry; | 165 | $entryToBeFlushed[] = $entry; |
166 | 166 | ||
167 | // flush every 20 entries | 167 | // flush every 20 entries |
168 | if (($i % 20) === 0) { | 168 | if (0 === ($i % 20)) { |
169 | $this->em->flush(); | 169 | $this->em->flush(); |
170 | 170 | ||
171 | foreach ($entryToBeFlushed as $entry) { | 171 | foreach ($entryToBeFlushed as $entry) { |
diff --git a/src/Wallabag/ImportBundle/Import/BrowserImport.php b/src/Wallabag/ImportBundle/Import/BrowserImport.php index 78077324..b5593180 100644 --- a/src/Wallabag/ImportBundle/Import/BrowserImport.php +++ b/src/Wallabag/ImportBundle/Import/BrowserImport.php | |||
@@ -171,7 +171,7 @@ abstract class BrowserImport extends AbstractImport | |||
171 | $entryToBeFlushed[] = $entry; | 171 | $entryToBeFlushed[] = $entry; |
172 | 172 | ||
173 | // flush every 20 entries | 173 | // flush every 20 entries |
174 | if (($i % 20) === 0) { | 174 | if (0 === ($i % 20)) { |
175 | $this->em->flush(); | 175 | $this->em->flush(); |
176 | 176 | ||
177 | foreach ($entryToBeFlushed as $entry) { | 177 | foreach ($entryToBeFlushed as $entry) { |
diff --git a/src/Wallabag/ImportBundle/Import/ChromeImport.php b/src/Wallabag/ImportBundle/Import/ChromeImport.php index e3ba636a..09183abe 100644 --- a/src/Wallabag/ImportBundle/Import/ChromeImport.php +++ b/src/Wallabag/ImportBundle/Import/ChromeImport.php | |||
@@ -45,7 +45,7 @@ class ChromeImport extends BrowserImport | |||
45 | 'created_at' => substr($entry['date_added'], 0, 10), | 45 | 'created_at' => substr($entry['date_added'], 0, 10), |
46 | ]; | 46 | ]; |
47 | 47 | ||
48 | if (array_key_exists('tags', $entry) && $entry['tags'] !== '') { | 48 | if (array_key_exists('tags', $entry) && '' !== $entry['tags']) { |
49 | $data['tags'] = $entry['tags']; | 49 | $data['tags'] = $entry['tags']; |
50 | } | 50 | } |
51 | 51 | ||
diff --git a/src/Wallabag/ImportBundle/Import/FirefoxImport.php b/src/Wallabag/ImportBundle/Import/FirefoxImport.php index c18e7e93..73269fe1 100644 --- a/src/Wallabag/ImportBundle/Import/FirefoxImport.php +++ b/src/Wallabag/ImportBundle/Import/FirefoxImport.php | |||
@@ -45,7 +45,7 @@ class FirefoxImport extends BrowserImport | |||
45 | 'created_at' => substr($entry['dateAdded'], 0, 10), | 45 | 'created_at' => substr($entry['dateAdded'], 0, 10), |
46 | ]; | 46 | ]; |
47 | 47 | ||
48 | if (array_key_exists('tags', $entry) && $entry['tags'] !== '') { | 48 | if (array_key_exists('tags', $entry) && '' !== $entry['tags']) { |
49 | $data['tags'] = $entry['tags']; | 49 | $data['tags'] = $entry['tags']; |
50 | } | 50 | } |
51 | 51 | ||
diff --git a/src/Wallabag/ImportBundle/Import/InstapaperImport.php b/src/Wallabag/ImportBundle/Import/InstapaperImport.php index 7d70154a..7ab69e7a 100644 --- a/src/Wallabag/ImportBundle/Import/InstapaperImport.php +++ b/src/Wallabag/ImportBundle/Import/InstapaperImport.php | |||
@@ -63,7 +63,7 @@ class InstapaperImport extends AbstractImport | |||
63 | 63 | ||
64 | $entries = []; | 64 | $entries = []; |
65 | $handle = fopen($this->filepath, 'r'); | 65 | $handle = fopen($this->filepath, 'r'); |
66 | while (($data = fgetcsv($handle, 10240)) !== false) { | 66 | while (false !== ($data = fgetcsv($handle, 10240))) { |
67 | if ('URL' === $data[0]) { | 67 | if ('URL' === $data[0]) { |
68 | continue; | 68 | continue; |
69 | } | 69 | } |
@@ -80,8 +80,8 @@ class InstapaperImport extends AbstractImport | |||
80 | 'url' => $data[0], | 80 | 'url' => $data[0], |
81 | 'title' => $data[1], | 81 | 'title' => $data[1], |
82 | 'status' => $data[3], | 82 | 'status' => $data[3], |
83 | 'is_archived' => $data[3] === 'Archive' || $data[3] === 'Starred', | 83 | 'is_archived' => 'Archive' === $data[3] || 'Starred' === $data[3], |
84 | 'is_starred' => $data[3] === 'Starred', | 84 | 'is_starred' => 'Starred' === $data[3], |
85 | 'html' => false, | 85 | 'html' => false, |
86 | 'tags' => $tags, | 86 | 'tags' => $tags, |
87 | ]; | 87 | ]; |
diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php index 7d38826b..dddb87f4 100644 --- a/src/Wallabag/ImportBundle/Import/PocketImport.php +++ b/src/Wallabag/ImportBundle/Import/PocketImport.php | |||
@@ -149,7 +149,7 @@ class PocketImport extends AbstractImport | |||
149 | // - first call get 5k offset 0 | 149 | // - first call get 5k offset 0 |
150 | // - second call get 5k offset 5k | 150 | // - second call get 5k offset 5k |
151 | // - and so on | 151 | // - and so on |
152 | if (count($entries['list']) === self::NB_ELEMENTS) { | 152 | if (self::NB_ELEMENTS === count($entries['list'])) { |
153 | ++$run; | 153 | ++$run; |
154 | 154 | ||
155 | return $this->import(self::NB_ELEMENTS * $run); | 155 | return $this->import(self::NB_ELEMENTS * $run); |
@@ -175,7 +175,7 @@ class PocketImport extends AbstractImport | |||
175 | */ | 175 | */ |
176 | public function parseEntry(array $importedEntry) | 176 | public function parseEntry(array $importedEntry) |
177 | { | 177 | { |
178 | $url = isset($importedEntry['resolved_url']) && $importedEntry['resolved_url'] !== '' ? $importedEntry['resolved_url'] : $importedEntry['given_url']; | 178 | $url = isset($importedEntry['resolved_url']) && '' !== $importedEntry['resolved_url'] ? $importedEntry['resolved_url'] : $importedEntry['given_url']; |
179 | 179 | ||
180 | $existingEntry = $this->em | 180 | $existingEntry = $this->em |
181 | ->getRepository('WallabagCoreBundle:Entry') | 181 | ->getRepository('WallabagCoreBundle:Entry') |
@@ -194,15 +194,15 @@ class PocketImport extends AbstractImport | |||
194 | $this->fetchContent($entry, $url); | 194 | $this->fetchContent($entry, $url); |
195 | 195 | ||
196 | // 0, 1, 2 - 1 if the item is archived - 2 if the item should be deleted | 196 | // 0, 1, 2 - 1 if the item is archived - 2 if the item should be deleted |
197 | $entry->setArchived($importedEntry['status'] === 1 || $this->markAsRead); | 197 | $entry->setArchived(1 === $importedEntry['status'] || $this->markAsRead); |
198 | 198 | ||
199 | // 0 or 1 - 1 If the item is starred | 199 | // 0 or 1 - 1 If the item is starred |
200 | $entry->setStarred($importedEntry['favorite'] === 1); | 200 | $entry->setStarred(1 === $importedEntry['favorite']); |
201 | 201 | ||
202 | $title = 'Untitled'; | 202 | $title = 'Untitled'; |
203 | if (isset($importedEntry['resolved_title']) && $importedEntry['resolved_title'] !== '') { | 203 | if (isset($importedEntry['resolved_title']) && '' !== $importedEntry['resolved_title']) { |
204 | $title = $importedEntry['resolved_title']; | 204 | $title = $importedEntry['resolved_title']; |
205 | } elseif (isset($importedEntry['given_title']) && $importedEntry['given_title'] !== '') { | 205 | } elseif (isset($importedEntry['given_title']) && '' !== $importedEntry['given_title']) { |
206 | $title = $importedEntry['given_title']; | 206 | $title = $importedEntry['given_title']; |
207 | } | 207 | } |
208 | 208 | ||
diff --git a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php index d585d44d..a35c411e 100644 --- a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php +++ b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php | |||
@@ -61,7 +61,7 @@ class WallabagV1Import extends WallabagImport | |||
61 | $data['html'] = $this->fetchingErrorMessage; | 61 | $data['html'] = $this->fetchingErrorMessage; |
62 | } | 62 | } |
63 | 63 | ||
64 | if (array_key_exists('tags', $entry) && $entry['tags'] !== '') { | 64 | if (array_key_exists('tags', $entry) && '' !== $entry['tags']) { |
65 | $data['tags'] = $entry['tags']; | 65 | $data['tags'] = $entry['tags']; |
66 | } | 66 | } |
67 | 67 | ||