aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php2
-rw-r--r--src/Wallabag/ApiBundle/Controller/EntryRestController.php8
-rw-r--r--src/Wallabag/ApiBundle/Controller/TagRestController.php4
-rw-r--r--src/Wallabag/CoreBundle/Command/CleanDuplicatesCommand.php8
-rw-r--r--src/Wallabag/CoreBundle/Command/ExportCommand.php2
-rw-r--r--src/Wallabag/CoreBundle/Command/InstallCommand.php8
-rw-r--r--src/Wallabag/CoreBundle/Command/ListUserCommand.php2
-rw-r--r--src/Wallabag/CoreBundle/Command/ReloadEntryCommand.php2
-rw-r--r--src/Wallabag/CoreBundle/Controller/ConfigController.php2
-rw-r--r--src/Wallabag/CoreBundle/Controller/TagController.php2
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php4
-rw-r--r--src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php2
-rw-r--r--src/Wallabag/CoreBundle/Helper/ContentProxy.php8
-rw-r--r--src/Wallabag/CoreBundle/Helper/CryptoProxy.php2
-rw-r--r--src/Wallabag/CoreBundle/Helper/DownloadImages.php4
-rw-r--r--src/Wallabag/CoreBundle/Helper/EntriesExport.php4
-rw-r--r--src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php2
-rw-r--r--src/Wallabag/CoreBundle/Helper/Redirect.php2
-rw-r--r--src/Wallabag/CoreBundle/Helper/TagsAssigner.php4
-rw-r--r--src/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverter.php2
-rw-r--r--src/Wallabag/CoreBundle/Repository/EntryRepository.php4
-rw-r--r--src/Wallabag/CoreBundle/Repository/TagRepository.php2
-rw-r--r--src/Wallabag/CoreBundle/Tools/Utils.php2
-rw-r--r--src/Wallabag/CoreBundle/Twig/WallabagExtension.php10
-rw-r--r--src/Wallabag/ImportBundle/Command/ImportCommand.php2
-rw-r--r--src/Wallabag/ImportBundle/Controller/BrowserController.php2
-rw-r--r--src/Wallabag/ImportBundle/Controller/InstapaperController.php2
-rw-r--r--src/Wallabag/ImportBundle/Controller/PinboardController.php2
-rw-r--r--src/Wallabag/ImportBundle/Controller/ReadabilityController.php2
-rw-r--r--src/Wallabag/ImportBundle/Controller/WallabagController.php2
-rw-r--r--src/Wallabag/ImportBundle/Import/BrowserImport.php2
-rw-r--r--src/Wallabag/ImportBundle/Import/InstapaperImport.php4
-rw-r--r--src/Wallabag/ImportBundle/Import/PocketImport.php2
-rw-r--r--src/Wallabag/ImportBundle/Import/WallabagV1Import.php2
34 files changed, 57 insertions, 57 deletions
diff --git a/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php b/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php
index f3090e65..3a7421c7 100644
--- a/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php
+++ b/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php
@@ -28,7 +28,7 @@ class WallabagAnnotationController extends FOSRestController
28 ->getDoctrine() 28 ->getDoctrine()
29 ->getRepository('WallabagAnnotationBundle:Annotation') 29 ->getRepository('WallabagAnnotationBundle:Annotation')
30 ->findAnnotationsByPageId($entry->getId(), $this->getUser()->getId()); 30 ->findAnnotationsByPageId($entry->getId(), $this->getUser()->getId());
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('jms_serializer')->serialize($annotations, 'json'); 34 $json = $this->get('jms_serializer')->serialize($annotations, 'json');
diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php
index fc47c479..0b4e74a0 100644
--- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php
+++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php
@@ -102,7 +102,7 @@ class EntryRestController extends WallabagRestController
102 $order = $request->query->get('order', 'desc'); 102 $order = $request->query->get('order', 'desc');
103 $page = (int) $request->query->get('page', 1); 103 $page = (int) $request->query->get('page', 1);
104 $perPage = (int) $request->query->get('perPage', 30); 104 $perPage = (int) $request->query->get('perPage', 30);
105 $tags = is_array($request->query->get('tags')) ? '' : (string) $request->query->get('tags', ''); 105 $tags = \is_array($request->query->get('tags')) ? '' : (string) $request->query->get('tags', '');
106 $since = $request->query->get('since', 0); 106 $since = $request->query->get('since', 0);
107 107
108 /** @var \Pagerfanta\Pagerfanta $pager */ 108 /** @var \Pagerfanta\Pagerfanta $pager */
@@ -253,7 +253,7 @@ class EntryRestController extends WallabagRestController
253 253
254 $limit = $this->container->getParameter('wallabag_core.api_limit_mass_actions'); 254 $limit = $this->container->getParameter('wallabag_core.api_limit_mass_actions');
255 255
256 if (count($urls) > $limit) { 256 if (\count($urls) > $limit) {
257 throw new HttpException(400, 'API limit reached'); 257 throw new HttpException(400, 'API limit reached');
258 } 258 }
259 259
@@ -347,7 +347,7 @@ class EntryRestController extends WallabagRestController
347 'open_graph' => [ 347 'open_graph' => [
348 'og_image' => !empty($data['picture']) ? $data['picture'] : $entry->getPreviewPicture(), 348 'og_image' => !empty($data['picture']) ? $data['picture'] : $entry->getPreviewPicture(),
349 ], 349 ],
350 'authors' => is_string($data['authors']) ? explode(',', $data['authors']) : $entry->getPublishedBy(), 350 'authors' => \is_string($data['authors']) ? explode(',', $data['authors']) : $entry->getPublishedBy(),
351 ] 351 ]
352 ); 352 );
353 } catch (\Exception $e) { 353 } catch (\Exception $e) {
@@ -461,7 +461,7 @@ class EntryRestController extends WallabagRestController
461 $contentProxy->updateLanguage($entry, $data['language']); 461 $contentProxy->updateLanguage($entry, $data['language']);
462 } 462 }
463 463
464 if (!empty($data['authors']) && is_string($data['authors'])) { 464 if (!empty($data['authors']) && \is_string($data['authors'])) {
465 $entry->setPublishedBy(explode(',', $data['authors'])); 465 $entry->setPublishedBy(explode(',', $data['authors']));
466 } 466 }
467 467
diff --git a/src/Wallabag/ApiBundle/Controller/TagRestController.php b/src/Wallabag/ApiBundle/Controller/TagRestController.php
index 9d333fe4..c6d6df6a 100644
--- a/src/Wallabag/ApiBundle/Controller/TagRestController.php
+++ b/src/Wallabag/ApiBundle/Controller/TagRestController.php
@@ -138,14 +138,14 @@ class TagRestController extends WallabagRestController
138 */ 138 */
139 private function cleanOrphanTag($tags) 139 private function cleanOrphanTag($tags)
140 { 140 {
141 if (!is_array($tags)) { 141 if (!\is_array($tags)) {
142 $tags = [$tags]; 142 $tags = [$tags];
143 } 143 }
144 144
145 $em = $this->getDoctrine()->getManager(); 145 $em = $this->getDoctrine()->getManager();
146 146
147 foreach ($tags as $tag) { 147 foreach ($tags as $tag) {
148 if (0 === count($tag->getEntries())) { 148 if (0 === \count($tag->getEntries())) {
149 $em->remove($tag); 149 $em->remove($tag);
150 } 150 }
151 } 151 }
diff --git a/src/Wallabag/CoreBundle/Command/CleanDuplicatesCommand.php b/src/Wallabag/CoreBundle/Command/CleanDuplicatesCommand.php
index b58909db..99170967 100644
--- a/src/Wallabag/CoreBundle/Command/CleanDuplicatesCommand.php
+++ b/src/Wallabag/CoreBundle/Command/CleanDuplicatesCommand.php
@@ -51,7 +51,7 @@ class CleanDuplicatesCommand extends ContainerAwareCommand
51 } else { 51 } else {
52 $users = $this->getContainer()->get('wallabag_user.user_repository')->findAll(); 52 $users = $this->getContainer()->get('wallabag_user.user_repository')->findAll();
53 53
54 $this->io->text(sprintf('Cleaning through <info>%d</info> user accounts', count($users))); 54 $this->io->text(sprintf('Cleaning through <info>%d</info> user accounts', \count($users)));
55 55
56 foreach ($users as $user) { 56 foreach ($users as $user) {
57 $this->io->text(sprintf('Processing user <info>%s</info>', $user->getUsername())); 57 $this->io->text(sprintf('Processing user <info>%s</info>', $user->getUsername()));
@@ -79,7 +79,7 @@ class CleanDuplicatesCommand extends ContainerAwareCommand
79 $url = $this->similarUrl($entry['url']); 79 $url = $this->similarUrl($entry['url']);
80 80
81 /* @var $entry Entry */ 81 /* @var $entry Entry */
82 if (in_array($url, $urls, true)) { 82 if (\in_array($url, $urls, true)) {
83 ++$duplicatesCount; 83 ++$duplicatesCount;
84 84
85 $em->remove($repo->find($entry['id'])); 85 $em->remove($repo->find($entry['id']));
@@ -96,8 +96,8 @@ class CleanDuplicatesCommand extends ContainerAwareCommand
96 96
97 private function similarUrl($url) 97 private function similarUrl($url)
98 { 98 {
99 if (in_array(substr($url, -1), ['/', '#'], true)) { // get rid of "/" and "#" and the end of urls 99 if (\in_array(substr($url, -1), ['/', '#'], true)) { // get rid of "/" and "#" and the end of urls
100 return substr($url, 0, strlen($url)); 100 return substr($url, 0, \strlen($url));
101 } 101 }
102 102
103 return $url; 103 return $url;
diff --git a/src/Wallabag/CoreBundle/Command/ExportCommand.php b/src/Wallabag/CoreBundle/Command/ExportCommand.php
index 75e9ad91..128f9d65 100644
--- a/src/Wallabag/CoreBundle/Command/ExportCommand.php
+++ b/src/Wallabag/CoreBundle/Command/ExportCommand.php
@@ -47,7 +47,7 @@ class ExportCommand extends ContainerAwareCommand
47 ->getQuery() 47 ->getQuery()
48 ->getResult(); 48 ->getResult();
49 49
50 $io->text(sprintf('Exporting <info>%d</info> entrie(s) for user <info>%s</info>...', count($entries), $user->getUserName())); 50 $io->text(sprintf('Exporting <info>%d</info> entrie(s) for user <info>%s</info>...', \count($entries), $user->getUserName()));
51 51
52 $filePath = $input->getArgument('filepath'); 52 $filePath = $input->getArgument('filepath');
53 53
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php
index a56a3257..3c76545c 100644
--- a/src/Wallabag/CoreBundle/Command/InstallCommand.php
+++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php
@@ -81,7 +81,7 @@ class InstallCommand extends ContainerAwareCommand
81 $status = '<info>OK!</info>'; 81 $status = '<info>OK!</info>';
82 $help = ''; 82 $help = '';
83 83
84 if (!extension_loaded($this->getContainer()->getParameter('database_driver'))) { 84 if (!\extension_loaded($this->getContainer()->getParameter('database_driver'))) {
85 $fulfilled = false; 85 $fulfilled = false;
86 $status = '<error>ERROR!</error>'; 86 $status = '<error>ERROR!</error>';
87 $help = 'Database driver "' . $this->getContainer()->getParameter('database_driver') . '" is not installed.'; 87 $help = 'Database driver "' . $this->getContainer()->getParameter('database_driver') . '" is not installed.';
@@ -146,7 +146,7 @@ class InstallCommand extends ContainerAwareCommand
146 $status = '<info>OK!</info>'; 146 $status = '<info>OK!</info>';
147 $help = ''; 147 $help = '';
148 148
149 if (!function_exists($functionRequired)) { 149 if (!\function_exists($functionRequired)) {
150 $fulfilled = false; 150 $fulfilled = false;
151 $status = '<error>ERROR!</error>'; 151 $status = '<error>ERROR!</error>';
152 $help = 'You need the ' . $functionRequired . ' function activated'; 152 $help = 'You need the ' . $functionRequired . ' function activated';
@@ -371,7 +371,7 @@ class InstallCommand extends ContainerAwareCommand
371 } 371 }
372 372
373 try { 373 try {
374 return in_array($databaseName, $schemaManager->listDatabases(), true); 374 return \in_array($databaseName, $schemaManager->listDatabases(), true);
375 } catch (\Doctrine\DBAL\Exception\DriverException $e) { 375 } catch (\Doctrine\DBAL\Exception\DriverException $e) {
376 // it means we weren't able to get database list, assume the database doesn't exist 376 // it means we weren't able to get database list, assume the database doesn't exist
377 377
@@ -389,6 +389,6 @@ class InstallCommand extends ContainerAwareCommand
389 { 389 {
390 $schemaManager = $this->getContainer()->get('doctrine')->getManager()->getConnection()->getSchemaManager(); 390 $schemaManager = $this->getContainer()->get('doctrine')->getManager()->getConnection()->getSchemaManager();
391 391
392 return count($schemaManager->listTableNames()) > 0 ? true : false; 392 return \count($schemaManager->listTableNames()) > 0 ? true : false;
393 } 393 }
394} 394}
diff --git a/src/Wallabag/CoreBundle/Command/ListUserCommand.php b/src/Wallabag/CoreBundle/Command/ListUserCommand.php
index 68e515da..a7101a02 100644
--- a/src/Wallabag/CoreBundle/Command/ListUserCommand.php
+++ b/src/Wallabag/CoreBundle/Command/ListUserCommand.php
@@ -50,7 +50,7 @@ class ListUserCommand extends ContainerAwareCommand
50 $io->success( 50 $io->success(
51 sprintf( 51 sprintf(
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 null === $input->getArgument('search') ? '' : ' (filtered)' 55 null === $input->getArgument('search') ? '' : ' (filtered)'
56 ) 56 )
diff --git a/src/Wallabag/CoreBundle/Command/ReloadEntryCommand.php b/src/Wallabag/CoreBundle/Command/ReloadEntryCommand.php
index 91998841..10918872 100644
--- a/src/Wallabag/CoreBundle/Command/ReloadEntryCommand.php
+++ b/src/Wallabag/CoreBundle/Command/ReloadEntryCommand.php
@@ -43,7 +43,7 @@ class ReloadEntryCommand extends ContainerAwareCommand
43 $entryRepository = $this->getContainer()->get('wallabag_core.entry_repository'); 43 $entryRepository = $this->getContainer()->get('wallabag_core.entry_repository');
44 $entryIds = $entryRepository->findAllEntriesIdByUserId($userId); 44 $entryIds = $entryRepository->findAllEntriesIdByUserId($userId);
45 45
46 $nbEntries = count($entryIds); 46 $nbEntries = \count($entryIds);
47 if (!$nbEntries) { 47 if (!$nbEntries) {
48 $io->success('No entry to reload.'); 48 $io->success('No entry to reload.');
49 49
diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php
index a89bb780..b999c539 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 (0 === count($tag->getEntries())) { 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/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php
index 616c37f2..b6d28e59 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 (0 === count($tag->getEntries())) { 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/Form/Type/EntryFilterType.php b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php
index 6f8c9e27..702c7f7a 100644
--- a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php
+++ b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php
@@ -33,7 +33,7 @@ class EntryFilterType extends AbstractType
33 33
34 $this->user = $tokenStorage->getToken() ? $tokenStorage->getToken()->getUser() : null; 34 $this->user = $tokenStorage->getToken() ? $tokenStorage->getToken()->getUser() : null;
35 35
36 if (null === $this->user || !is_object($this->user)) { 36 if (null === $this->user || !\is_object($this->user)) {
37 return; 37 return;
38 } 38 }
39 } 39 }
@@ -96,7 +96,7 @@ class EntryFilterType extends AbstractType
96 ->add('domainName', TextFilterType::class, [ 96 ->add('domainName', TextFilterType::class, [
97 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { 97 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) {
98 $value = $values['value']; 98 $value = $values['value'];
99 if (strlen($value) <= 2 || empty($value)) { 99 if (\strlen($value) <= 2 || empty($value)) {
100 return; 100 return;
101 } 101 }
102 $expression = $filterQuery->getExpr()->like($field, $filterQuery->getExpr()->lower($filterQuery->getExpr()->literal('%' . $value . '%'))); 102 $expression = $filterQuery->getExpr()->like($field, $filterQuery->getExpr()->lower($filterQuery->getExpr()->literal('%' . $value . '%')));
diff --git a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php
index 2c85da62..90e00c62 100644
--- a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php
+++ b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php
@@ -107,7 +107,7 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder
107 */ 107 */
108 protected function processExtraFields($extraFieldsStrings) 108 protected function processExtraFields($extraFieldsStrings)
109 { 109 {
110 if (!is_array($extraFieldsStrings)) { 110 if (!\is_array($extraFieldsStrings)) {
111 return []; 111 return [];
112 } 112 }
113 113
diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php
index fe795d42..3fe31c2c 100644
--- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php
+++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php
@@ -85,7 +85,7 @@ class ContentProxy
85 (new LocaleConstraint()) 85 (new LocaleConstraint())
86 ); 86 );
87 87
88 if (0 === count($errors)) { 88 if (0 === \count($errors)) {
89 $entry->setLanguage($value); 89 $entry->setLanguage($value);
90 90
91 return; 91 return;
@@ -107,7 +107,7 @@ class ContentProxy
107 (new UrlConstraint()) 107 (new UrlConstraint())
108 ); 108 );
109 109
110 if (0 === count($errors)) { 110 if (0 === \count($errors)) {
111 $entry->setPreviewPicture($value); 111 $entry->setPreviewPicture($value);
112 112
113 return; 113 return;
@@ -212,7 +212,7 @@ class ContentProxy
212 $entry->setHttpStatus($content['status']); 212 $entry->setHttpStatus($content['status']);
213 } 213 }
214 214
215 if (!empty($content['authors']) && is_array($content['authors'])) { 215 if (!empty($content['authors']) && \is_array($content['authors'])) {
216 $entry->setPublishedBy($content['authors']); 216 $entry->setPublishedBy($content['authors']);
217 } 217 }
218 218
@@ -233,7 +233,7 @@ class ContentProxy
233 } 233 }
234 234
235 // if content is an image, define it as a preview too 235 // if content is an image, define it as a preview too
236 if (!empty($content['content_type']) && in_array($this->mimeGuesser->guess($content['content_type']), ['jpeg', 'jpg', 'gif', 'png'], true)) { 236 if (!empty($content['content_type']) && \in_array($this->mimeGuesser->guess($content['content_type']), ['jpeg', 'jpg', 'gif', 'png'], true)) {
237 $this->updatePreviewPicture($entry, $content['url']); 237 $this->updatePreviewPicture($entry, $content['url']);
238 } 238 }
239 239
diff --git a/src/Wallabag/CoreBundle/Helper/CryptoProxy.php b/src/Wallabag/CoreBundle/Helper/CryptoProxy.php
index 7d8c9888..67d73915 100644
--- a/src/Wallabag/CoreBundle/Helper/CryptoProxy.php
+++ b/src/Wallabag/CoreBundle/Helper/CryptoProxy.php
@@ -81,6 +81,6 @@ class CryptoProxy
81 */ 81 */
82 private function mask($value) 82 private function mask($value)
83 { 83 {
84 return strlen($value) > 0 ? $value[0] . '*****' . $value[strlen($value) - 1] : 'Empty value'; 84 return \strlen($value) > 0 ? $value[0] . '*****' . $value[\strlen($value) - 1] : 'Empty value';
85 } 85 }
86} 86}
diff --git a/src/Wallabag/CoreBundle/Helper/DownloadImages.php b/src/Wallabag/CoreBundle/Helper/DownloadImages.php
index 487a3a23..cc3dcfce 100644
--- a/src/Wallabag/CoreBundle/Helper/DownloadImages.php
+++ b/src/Wallabag/CoreBundle/Helper/DownloadImages.php
@@ -198,7 +198,7 @@ class DownloadImages
198 // Must be one or more digits followed by w OR x 198 // Must be one or more digits followed by w OR x
199 $pattern = "/(?:[^\"'\s]+\s*(?:\d+[wx])+)/"; 199 $pattern = "/(?:[^\"'\s]+\s*(?:\d+[wx])+)/";
200 preg_match_all($pattern, $srcsetAttribute, $matches); 200 preg_match_all($pattern, $srcsetAttribute, $matches);
201 $srcset = call_user_func_array('array_merge', $matches); 201 $srcset = \call_user_func_array('array_merge', $matches);
202 $srcsetUrls = array_map(function ($src) { 202 $srcsetUrls = array_map(function ($src) {
203 return trim(explode(' ', $src, 2)[0]); 203 return trim(explode(' ', $src, 2)[0]);
204 }, $srcset); 204 }, $srcset);
@@ -308,7 +308,7 @@ class DownloadImages
308 $this->logger->debug('DownloadImages: Checking extension (alternative)', ['ext' => $ext]); 308 $this->logger->debug('DownloadImages: Checking extension (alternative)', ['ext' => $ext]);
309 } 309 }
310 310
311 if (!in_array($ext, ['jpeg', 'jpg', 'gif', 'png'], true)) { 311 if (!\in_array($ext, ['jpeg', 'jpg', 'gif', 'png'], true)) {
312 $this->logger->error('DownloadImages: Processed image with not allowed extension. Skipping: ' . $imagePath); 312 $this->logger->error('DownloadImages: Processed image with not allowed extension. Skipping: ' . $imagePath);
313 313
314 return false; 314 return false;
diff --git a/src/Wallabag/CoreBundle/Helper/EntriesExport.php b/src/Wallabag/CoreBundle/Helper/EntriesExport.php
index 136f66f5..cbf1037b 100644
--- a/src/Wallabag/CoreBundle/Helper/EntriesExport.php
+++ b/src/Wallabag/CoreBundle/Helper/EntriesExport.php
@@ -45,7 +45,7 @@ class EntriesExport
45 */ 45 */
46 public function setEntries($entries) 46 public function setEntries($entries)
47 { 47 {
48 if (!is_array($entries)) { 48 if (!\is_array($entries)) {
49 $this->language = $entries->getLanguage(); 49 $this->language = $entries->getLanguage();
50 $entries = [$entries]; 50 $entries = [$entries];
51 } 51 }
@@ -325,7 +325,7 @@ class EntriesExport
325 { 325 {
326 $delimiter = ';'; 326 $delimiter = ';';
327 $enclosure = '"'; 327 $enclosure = '"';
328 $handle = fopen('php://memory', 'rb+'); 328 $handle = fopen('php://memory', 'b+r');
329 329
330 fputcsv($handle, ['Title', 'URL', 'Content', 'Tags', 'MIME Type', 'Language', 'Creation date'], $delimiter, $enclosure); 330 fputcsv($handle, ['Title', 'URL', 'Content', 'Tags', 'MIME Type', 'Language', 'Creation date'], $delimiter, $enclosure);
331 331
diff --git a/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php b/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php
index 49c1ea41..1c2c5093 100644
--- a/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php
+++ b/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php
@@ -31,7 +31,7 @@ class PreparePagerForEntries
31 $user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null; 31 $user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null;
32 } 32 }
33 33
34 if (null === $user || !is_object($user)) { 34 if (null === $user || !\is_object($user)) {
35 return; 35 return;
36 } 36 }
37 37
diff --git a/src/Wallabag/CoreBundle/Helper/Redirect.php b/src/Wallabag/CoreBundle/Helper/Redirect.php
index abc84d08..9d1a6345 100644
--- a/src/Wallabag/CoreBundle/Helper/Redirect.php
+++ b/src/Wallabag/CoreBundle/Helper/Redirect.php
@@ -31,7 +31,7 @@ class Redirect
31 { 31 {
32 $user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null; 32 $user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null;
33 33
34 if (null === $user || !is_object($user)) { 34 if (null === $user || !\is_object($user)) {
35 return $url; 35 return $url;
36 } 36 }
37 37
diff --git a/src/Wallabag/CoreBundle/Helper/TagsAssigner.php b/src/Wallabag/CoreBundle/Helper/TagsAssigner.php
index 0bfe5c57..e6b4989f 100644
--- a/src/Wallabag/CoreBundle/Helper/TagsAssigner.php
+++ b/src/Wallabag/CoreBundle/Helper/TagsAssigner.php
@@ -32,7 +32,7 @@ class TagsAssigner
32 { 32 {
33 $tagsEntities = []; 33 $tagsEntities = [];
34 34
35 if (!is_array($tags)) { 35 if (!\is_array($tags)) {
36 $tags = explode(',', $tags); 36 $tags = explode(',', $tags);
37 } 37 }
38 38
@@ -48,7 +48,7 @@ class TagsAssigner
48 $label = trim(mb_convert_case($label, MB_CASE_LOWER)); 48 $label = trim(mb_convert_case($label, MB_CASE_LOWER));
49 49
50 // avoid empty tag 50 // avoid empty tag
51 if (0 === strlen($label)) { 51 if (0 === \strlen($label)) {
52 continue; 52 continue;
53 } 53 }
54 54
diff --git a/src/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverter.php b/src/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverter.php
index 40b5673d..4a2fcab5 100644
--- a/src/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverter.php
+++ b/src/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverter.php
@@ -36,7 +36,7 @@ class UsernameRssTokenConverter implements ParamConverterInterface
36 { 36 {
37 // If there is no manager, this means that only Doctrine DBAL is configured 37 // If there is no manager, this means that only Doctrine DBAL is configured
38 // In this case we can do nothing and just return 38 // In this case we can do nothing and just return
39 if (null === $this->registry || !count($this->registry->getManagers())) { 39 if (null === $this->registry || !\count($this->registry->getManagers())) {
40 return false; 40 return false;
41 } 41 }
42 42
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
index b5e35eff..38a3026d 100644
--- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php
+++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
@@ -151,7 +151,7 @@ class EntryRepository extends EntityRepository
151 $qb->andWhere('e.updatedAt > :since')->setParameter('since', new \DateTime(date('Y-m-d H:i:s', $since))); 151 $qb->andWhere('e.updatedAt > :since')->setParameter('since', new \DateTime(date('Y-m-d H:i:s', $since)));
152 } 152 }
153 153
154 if (is_string($tags) && '' !== $tags) { 154 if (\is_string($tags) && '' !== $tags) {
155 foreach (explode(',', $tags) as $i => $tag) { 155 foreach (explode(',', $tags) as $i => $tag) {
156 $entryAlias = 'e' . $i; 156 $entryAlias = 'e' . $i;
157 $tagAlias = 't' . $i; 157 $tagAlias = 't' . $i;
@@ -320,7 +320,7 @@ class EntryRepository extends EntityRepository
320 ->getQuery() 320 ->getQuery()
321 ->getResult(); 321 ->getResult();
322 322
323 if (count($res)) { 323 if (\count($res)) {
324 return current($res); 324 return current($res);
325 } 325 }
326 326
diff --git a/src/Wallabag/CoreBundle/Repository/TagRepository.php b/src/Wallabag/CoreBundle/Repository/TagRepository.php
index 5c45211f..3ae9d414 100644
--- a/src/Wallabag/CoreBundle/Repository/TagRepository.php
+++ b/src/Wallabag/CoreBundle/Repository/TagRepository.php
@@ -30,7 +30,7 @@ class TagRepository extends EntityRepository
30 $query->setResultCacheLifetime($cacheLifeTime); 30 $query->setResultCacheLifetime($cacheLifeTime);
31 } 31 }
32 32
33 return count($query->getArrayResult()); 33 return \count($query->getArrayResult());
34 } 34 }
35 35
36 /** 36 /**
diff --git a/src/Wallabag/CoreBundle/Tools/Utils.php b/src/Wallabag/CoreBundle/Tools/Utils.php
index eba21c02..46bb1dc5 100644
--- a/src/Wallabag/CoreBundle/Tools/Utils.php
+++ b/src/Wallabag/CoreBundle/Tools/Utils.php
@@ -29,6 +29,6 @@ class Utils
29 */ 29 */
30 public static function getReadingTime($text) 30 public static function getReadingTime($text)
31 { 31 {
32 return floor(count(preg_split('~[^\p{L}\p{N}\']+~u', strip_tags($text))) / 200); 32 return floor(\count(preg_split('~[^\p{L}\p{N}\']+~u', strip_tags($text))) / 200);
33 } 33 }
34} 34}
diff --git a/src/Wallabag/CoreBundle/Twig/WallabagExtension.php b/src/Wallabag/CoreBundle/Twig/WallabagExtension.php
index 8992117e..00b1e595 100644
--- a/src/Wallabag/CoreBundle/Twig/WallabagExtension.php
+++ b/src/Wallabag/CoreBundle/Twig/WallabagExtension.php
@@ -64,7 +64,7 @@ class WallabagExtension extends \Twig_Extension implements \Twig_Extension_Globa
64 { 64 {
65 $user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null; 65 $user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null;
66 66
67 if (null === $user || !is_object($user)) { 67 if (null === $user || !\is_object($user)) {
68 return 0; 68 return 0;
69 } 69 }
70 70
@@ -96,7 +96,7 @@ class WallabagExtension extends \Twig_Extension implements \Twig_Extension_Globa
96 $query->useResultCache(true); 96 $query->useResultCache(true);
97 $query->setResultCacheLifetime($this->lifeTime); 97 $query->setResultCacheLifetime($this->lifeTime);
98 98
99 return count($query->getArrayResult()); 99 return \count($query->getArrayResult());
100 } 100 }
101 101
102 /** 102 /**
@@ -108,7 +108,7 @@ class WallabagExtension extends \Twig_Extension implements \Twig_Extension_Globa
108 { 108 {
109 $user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null; 109 $user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null;
110 110
111 if (null === $user || !is_object($user)) { 111 if (null === $user || !\is_object($user)) {
112 return 0; 112 return 0;
113 } 113 }
114 114
@@ -124,7 +124,7 @@ class WallabagExtension extends \Twig_Extension implements \Twig_Extension_Globa
124 { 124 {
125 $user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null; 125 $user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null;
126 126
127 if (null === $user || !is_object($user)) { 127 if (null === $user || !\is_object($user)) {
128 return 0; 128 return 0;
129 } 129 }
130 130
@@ -137,7 +137,7 @@ class WallabagExtension extends \Twig_Extension implements \Twig_Extension_Globa
137 $query->useResultCache(true); 137 $query->useResultCache(true);
138 $query->setResultCacheLifetime($this->lifeTime); 138 $query->setResultCacheLifetime($this->lifeTime);
139 139
140 $nbArchives = count($query->getArrayResult()); 140 $nbArchives = \count($query->getArrayResult());
141 141
142 $interval = $user->getCreatedAt()->diff(new \DateTime('now')); 142 $interval = $user->getCreatedAt()->diff(new \DateTime('now'));
143 $nbDays = (int) $interval->format('%a') ?: 1; 143 $nbDays = (int) $interval->format('%a') ?: 1;
diff --git a/src/Wallabag/ImportBundle/Command/ImportCommand.php b/src/Wallabag/ImportBundle/Command/ImportCommand.php
index 99056c2c..f9ffe994 100644
--- a/src/Wallabag/ImportBundle/Command/ImportCommand.php
+++ b/src/Wallabag/ImportBundle/Command/ImportCommand.php
@@ -43,7 +43,7 @@ class ImportCommand extends ContainerAwareCommand
43 $user = $em->getRepository('WallabagUserBundle:User')->findOneByUsername($input->getArgument('username')); 43 $user = $em->getRepository('WallabagUserBundle:User')->findOneByUsername($input->getArgument('username'));
44 } 44 }
45 45
46 if (!is_object($user)) { 46 if (!\is_object($user)) {
47 throw new Exception(sprintf('User "%s" not found', $input->getArgument('username'))); 47 throw new Exception(sprintf('User "%s" not found', $input->getArgument('username')));
48 } 48 }
49 49
diff --git a/src/Wallabag/ImportBundle/Controller/BrowserController.php b/src/Wallabag/ImportBundle/Controller/BrowserController.php
index 77a7a904..6418925c 100644
--- a/src/Wallabag/ImportBundle/Controller/BrowserController.php
+++ b/src/Wallabag/ImportBundle/Controller/BrowserController.php
@@ -30,7 +30,7 @@ abstract class BrowserController extends Controller
30 $markAsRead = $form->get('mark_as_read')->getData(); 30 $markAsRead = $form->get('mark_as_read')->getData();
31 $name = $this->getUser()->getId() . '.json'; 31 $name = $this->getUser()->getId() . '.json';
32 32
33 if (null !== $file && in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) { 33 if (null !== $file && \in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) {
34 $res = $wallabag 34 $res = $wallabag
35 ->setFilepath($this->getParameter('wallabag_import.resource_dir') . '/' . $name) 35 ->setFilepath($this->getParameter('wallabag_import.resource_dir') . '/' . $name)
36 ->setMarkAsRead($markAsRead) 36 ->setMarkAsRead($markAsRead)
diff --git a/src/Wallabag/ImportBundle/Controller/InstapaperController.php b/src/Wallabag/ImportBundle/Controller/InstapaperController.php
index 550679c3..f184baf9 100644
--- a/src/Wallabag/ImportBundle/Controller/InstapaperController.php
+++ b/src/Wallabag/ImportBundle/Controller/InstapaperController.php
@@ -31,7 +31,7 @@ class InstapaperController extends Controller
31 $markAsRead = $form->get('mark_as_read')->getData(); 31 $markAsRead = $form->get('mark_as_read')->getData();
32 $name = 'instapaper_' . $this->getUser()->getId() . '.csv'; 32 $name = 'instapaper_' . $this->getUser()->getId() . '.csv';
33 33
34 if (null !== $file && in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) { 34 if (null !== $file && \in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) {
35 $res = $instapaper 35 $res = $instapaper
36 ->setFilepath($this->getParameter('wallabag_import.resource_dir') . '/' . $name) 36 ->setFilepath($this->getParameter('wallabag_import.resource_dir') . '/' . $name)
37 ->setMarkAsRead($markAsRead) 37 ->setMarkAsRead($markAsRead)
diff --git a/src/Wallabag/ImportBundle/Controller/PinboardController.php b/src/Wallabag/ImportBundle/Controller/PinboardController.php
index 0e57fd41..6f54c69a 100644
--- a/src/Wallabag/ImportBundle/Controller/PinboardController.php
+++ b/src/Wallabag/ImportBundle/Controller/PinboardController.php
@@ -31,7 +31,7 @@ class PinboardController extends Controller
31 $markAsRead = $form->get('mark_as_read')->getData(); 31 $markAsRead = $form->get('mark_as_read')->getData();
32 $name = 'pinboard_' . $this->getUser()->getId() . '.json'; 32 $name = 'pinboard_' . $this->getUser()->getId() . '.json';
33 33
34 if (null !== $file && in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) { 34 if (null !== $file && \in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) {
35 $res = $pinboard 35 $res = $pinboard
36 ->setFilepath($this->getParameter('wallabag_import.resource_dir') . '/' . $name) 36 ->setFilepath($this->getParameter('wallabag_import.resource_dir') . '/' . $name)
37 ->setMarkAsRead($markAsRead) 37 ->setMarkAsRead($markAsRead)
diff --git a/src/Wallabag/ImportBundle/Controller/ReadabilityController.php b/src/Wallabag/ImportBundle/Controller/ReadabilityController.php
index 59de24cb..729a97a3 100644
--- a/src/Wallabag/ImportBundle/Controller/ReadabilityController.php
+++ b/src/Wallabag/ImportBundle/Controller/ReadabilityController.php
@@ -31,7 +31,7 @@ class ReadabilityController extends Controller
31 $markAsRead = $form->get('mark_as_read')->getData(); 31 $markAsRead = $form->get('mark_as_read')->getData();
32 $name = 'readability_' . $this->getUser()->getId() . '.json'; 32 $name = 'readability_' . $this->getUser()->getId() . '.json';
33 33
34 if (null !== $file && in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) { 34 if (null !== $file && \in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) {
35 $res = $readability 35 $res = $readability
36 ->setFilepath($this->getParameter('wallabag_import.resource_dir') . '/' . $name) 36 ->setFilepath($this->getParameter('wallabag_import.resource_dir') . '/' . $name)
37 ->setMarkAsRead($markAsRead) 37 ->setMarkAsRead($markAsRead)
diff --git a/src/Wallabag/ImportBundle/Controller/WallabagController.php b/src/Wallabag/ImportBundle/Controller/WallabagController.php
index 6e6524b4..d182dd2c 100644
--- a/src/Wallabag/ImportBundle/Controller/WallabagController.php
+++ b/src/Wallabag/ImportBundle/Controller/WallabagController.php
@@ -33,7 +33,7 @@ abstract class WallabagController extends Controller
33 $markAsRead = $form->get('mark_as_read')->getData(); 33 $markAsRead = $form->get('mark_as_read')->getData();
34 $name = $this->getUser()->getId() . '.json'; 34 $name = $this->getUser()->getId() . '.json';
35 35
36 if (null !== $file && in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) { 36 if (null !== $file && \in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) {
37 $res = $wallabag 37 $res = $wallabag
38 ->setFilepath($this->getParameter('wallabag_import.resource_dir') . '/' . $name) 38 ->setFilepath($this->getParameter('wallabag_import.resource_dir') . '/' . $name)
39 ->setMarkAsRead($markAsRead) 39 ->setMarkAsRead($markAsRead)
diff --git a/src/Wallabag/ImportBundle/Import/BrowserImport.php b/src/Wallabag/ImportBundle/Import/BrowserImport.php
index b5593180..225f1791 100644
--- a/src/Wallabag/ImportBundle/Import/BrowserImport.php
+++ b/src/Wallabag/ImportBundle/Import/BrowserImport.php
@@ -77,7 +77,7 @@ abstract class BrowserImport extends AbstractImport
77 */ 77 */
78 public function parseEntry(array $importedEntry) 78 public function parseEntry(array $importedEntry)
79 { 79 {
80 if ((!array_key_exists('guid', $importedEntry) || (!array_key_exists('id', $importedEntry))) && is_array(reset($importedEntry))) { 80 if ((!array_key_exists('guid', $importedEntry) || (!array_key_exists('id', $importedEntry))) && \is_array(reset($importedEntry))) {
81 if ($this->producer) { 81 if ($this->producer) {
82 $this->parseEntriesForProducer($importedEntry); 82 $this->parseEntriesForProducer($importedEntry);
83 83
diff --git a/src/Wallabag/ImportBundle/Import/InstapaperImport.php b/src/Wallabag/ImportBundle/Import/InstapaperImport.php
index 7ab69e7a..e4f0970c 100644
--- a/src/Wallabag/ImportBundle/Import/InstapaperImport.php
+++ b/src/Wallabag/ImportBundle/Import/InstapaperImport.php
@@ -62,7 +62,7 @@ class InstapaperImport extends AbstractImport
62 } 62 }
63 63
64 $entries = []; 64 $entries = [];
65 $handle = fopen($this->filepath, 'r'); 65 $handle = fopen($this->filepath, 'rb');
66 while (false !== ($data = fgetcsv($handle, 10240))) { 66 while (false !== ($data = fgetcsv($handle, 10240))) {
67 if ('URL' === $data[0]) { 67 if ('URL' === $data[0]) {
68 continue; 68 continue;
@@ -72,7 +72,7 @@ class InstapaperImport extends AbstractImport
72 // BUT it can also be the status (since status = folder in Instapaper) 72 // BUT it can also be the status (since status = folder in Instapaper)
73 // and we don't want archive, unread & starred to become a tag 73 // and we don't want archive, unread & starred to become a tag
74 $tags = null; 74 $tags = null;
75 if (false === in_array($data[3], ['Archive', 'Unread', 'Starred'], true)) { 75 if (false === \in_array($data[3], ['Archive', 'Unread', 'Starred'], true)) {
76 $tags = [$data[3]]; 76 $tags = [$data[3]];
77 } 77 }
78 78
diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php
index dddb87f4..c1b35b7e 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 (self::NB_ELEMENTS === count($entries['list'])) { 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);
diff --git a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php
index a35c411e..b9bb525a 100644
--- a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php
+++ b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php
@@ -56,7 +56,7 @@ class WallabagV1Import extends WallabagImport
56 56
57 // In case of a bad fetch in v1, replace title and content with v2 error strings 57 // In case of a bad fetch in v1, replace title and content with v2 error strings
58 // If fetching fails again, they will get this instead of the v1 strings 58 // If fetching fails again, they will get this instead of the v1 strings
59 if (in_array($entry['title'], $this->untitled, true)) { 59 if (\in_array($entry['title'], $this->untitled, true)) {
60 $data['title'] = $this->fetchingErrorMessageTitle; 60 $data['title'] = $this->fetchingErrorMessageTitle;
61 $data['html'] = $this->fetchingErrorMessage; 61 $data['html'] = $this->fetchingErrorMessage;
62 } 62 }