aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Helper
diff options
context:
space:
mode:
authorKevin Decherf <kevin@kdecherf.com>2018-09-05 14:25:32 +0200
committerKevin Decherf <kevin@kdecherf.com>2018-09-05 14:25:32 +0200
commit2a1ceb67b4400f46f4d3067e887ff54aa906f0a2 (patch)
treedf0b695eb99e96dc55b63b27a404080c23421639 /src/Wallabag/CoreBundle/Helper
parent685a5d745e2b723a09111d7d31157cced67ea9b4 (diff)
downloadwallabag-2a1ceb67b4400f46f4d3067e887ff54aa906f0a2.tar.gz
wallabag-2a1ceb67b4400f46f4d3067e887ff54aa906f0a2.tar.zst
wallabag-2a1ceb67b4400f46f4d3067e887ff54aa906f0a2.zip
php-cs-fixer
Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
Diffstat (limited to 'src/Wallabag/CoreBundle/Helper')
-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
7 files changed, 13 insertions, 13 deletions
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