aboutsummaryrefslogtreecommitdiffhomepage
path: root/application
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2018-03-07 21:53:53 +0100
committerGitHub <noreply@github.com>2018-03-07 21:53:53 +0100
commit39ee93925b66b527c4386647001fadc898c52a2c (patch)
treeb8e0548c6ba1716b6c3f2bde9f81e8f4d913eeb2 /application
parenta58a8856a88cefe22027d419fac2e5664fc9ba61 (diff)
parentd2d4f993e1e76bc68b65c48cb18476c404c97a41 (diff)
downloadShaarli-39ee93925b66b527c4386647001fadc898c52a2c.tar.gz
Shaarli-39ee93925b66b527c4386647001fadc898c52a2c.tar.zst
Shaarli-39ee93925b66b527c4386647001fadc898c52a2c.zip
Merge pull request #1097 from ArthurHoaro/fix/psr-elseif
PSR: use elseif instead of else if
Diffstat (limited to 'application')
-rw-r--r--application/FileUtils.php2
-rw-r--r--application/LinkFilter.php8
-rw-r--r--application/NetscapeBookmarkUtils.php4
-rw-r--r--application/Url.php2
-rw-r--r--application/api/controllers/History.php4
-rw-r--r--application/api/controllers/Links.php4
6 files changed, 12 insertions, 12 deletions
diff --git a/application/FileUtils.php b/application/FileUtils.php
index 918cb83b..b89ea12b 100644
--- a/application/FileUtils.php
+++ b/application/FileUtils.php
@@ -37,7 +37,7 @@ class FileUtils
37 if (is_file($file) && !is_writeable($file)) { 37 if (is_file($file) && !is_writeable($file)) {
38 // The datastore exists but is not writeable 38 // The datastore exists but is not writeable
39 throw new IOException($file); 39 throw new IOException($file);
40 } else if (!is_file($file) && !is_writeable(dirname($file))) { 40 } elseif (!is_file($file) && !is_writeable(dirname($file))) {
41 // The datastore does not exist and its parent directory is not writeable 41 // The datastore does not exist and its parent directory is not writeable
42 throw new IOException(dirname($file)); 42 throw new IOException(dirname($file));
43 } 43 }
diff --git a/application/LinkFilter.php b/application/LinkFilter.php
index 12376e27..e52239b8 100644
--- a/application/LinkFilter.php
+++ b/application/LinkFilter.php
@@ -117,7 +117,7 @@ class LinkFilter
117 foreach ($this->links as $key => $value) { 117 foreach ($this->links as $key => $value) {
118 if ($value['private'] && $visibility === 'private') { 118 if ($value['private'] && $visibility === 'private') {
119 $out[$key] = $value; 119 $out[$key] = $value;
120 } else if (! $value['private'] && $visibility === 'public') { 120 } elseif (! $value['private'] && $visibility === 'public') {
121 $out[$key] = $value; 121 $out[$key] = $value;
122 } 122 }
123 } 123 }
@@ -210,7 +210,7 @@ class LinkFilter
210 if ($visibility !== 'all') { 210 if ($visibility !== 'all') {
211 if (! $link['private'] && $visibility === 'private') { 211 if (! $link['private'] && $visibility === 'private') {
212 continue; 212 continue;
213 } else if ($link['private'] && $visibility === 'public') { 213 } elseif ($link['private'] && $visibility === 'public') {
214 continue; 214 continue;
215 } 215 }
216 } 216 }
@@ -337,7 +337,7 @@ class LinkFilter
337 if ($visibility !== 'all') { 337 if ($visibility !== 'all') {
338 if (! $link['private'] && $visibility === 'private') { 338 if (! $link['private'] && $visibility === 'private') {
339 continue; 339 continue;
340 } else if ($link['private'] && $visibility === 'public') { 340 } elseif ($link['private'] && $visibility === 'public') {
341 continue; 341 continue;
342 } 342 }
343 } 343 }
@@ -380,7 +380,7 @@ class LinkFilter
380 if ($visibility !== 'all') { 380 if ($visibility !== 'all') {
381 if (! $link['private'] && $visibility === 'private') { 381 if (! $link['private'] && $visibility === 'private') {
382 continue; 382 continue;
383 } else if ($link['private'] && $visibility === 'public') { 383 } elseif ($link['private'] && $visibility === 'public') {
384 continue; 384 continue;
385 } 385 }
386 } 386 }
diff --git a/application/NetscapeBookmarkUtils.php b/application/NetscapeBookmarkUtils.php
index 2aa2da3b..b4d16d00 100644
--- a/application/NetscapeBookmarkUtils.php
+++ b/application/NetscapeBookmarkUtils.php
@@ -154,10 +154,10 @@ class NetscapeBookmarkUtils
154 if (empty($post['privacy']) || $post['privacy'] == 'default') { 154 if (empty($post['privacy']) || $post['privacy'] == 'default') {
155 // use value from the imported file 155 // use value from the imported file
156 $private = $bkm['pub'] == '1' ? 0 : 1; 156 $private = $bkm['pub'] == '1' ? 0 : 1;
157 } else if ($post['privacy'] == 'private') { 157 } elseif ($post['privacy'] == 'private') {
158 // all imported links are private 158 // all imported links are private
159 $private = 1; 159 $private = 1;
160 } else if ($post['privacy'] == 'public') { 160 } elseif ($post['privacy'] == 'public') {
161 // all imported links are public 161 // all imported links are public
162 $private = 0; 162 $private = 0;
163 } 163 }
diff --git a/application/Url.php b/application/Url.php
index 21c17ecc..6b9870f0 100644
--- a/application/Url.php
+++ b/application/Url.php
@@ -81,7 +81,7 @@ function whitelist_protocols($url, $protocols)
81 // Protocol not allowed: we remove it and replace it with http 81 // Protocol not allowed: we remove it and replace it with http
82 if ($protocol === 1 && ! in_array($match[1], $protocols)) { 82 if ($protocol === 1 && ! in_array($match[1], $protocols)) {
83 $url = str_replace($match[0], 'http://', $url); 83 $url = str_replace($match[0], 'http://', $url);
84 } else if ($protocol !== 1) { 84 } elseif ($protocol !== 1) {
85 $url = 'http://' . $url; 85 $url = 'http://' . $url;
86 } 86 }
87 return $url; 87 return $url;
diff --git a/application/api/controllers/History.php b/application/api/controllers/History.php
index 2ff9deaf..5cc453bf 100644
--- a/application/api/controllers/History.php
+++ b/application/api/controllers/History.php
@@ -36,7 +36,7 @@ class History extends ApiController
36 if (empty($offset)) { 36 if (empty($offset)) {
37 $offset = 0; 37 $offset = 0;
38 } 38 }
39 else if (ctype_digit($offset)) { 39 elseif (ctype_digit($offset)) {
40 $offset = (int) $offset; 40 $offset = (int) $offset;
41 } else { 41 } else {
42 throw new ApiBadParametersException('Invalid offset'); 42 throw new ApiBadParametersException('Invalid offset');
@@ -46,7 +46,7 @@ class History extends ApiController
46 $limit = $request->getParam('limit'); 46 $limit = $request->getParam('limit');
47 if (empty($limit)) { 47 if (empty($limit)) {
48 $limit = count($history); 48 $limit = count($history);
49 } else if (ctype_digit($limit)) { 49 } elseif (ctype_digit($limit)) {
50 $limit = (int) $limit; 50 $limit = (int) $limit;
51 } else { 51 } else {
52 throw new ApiBadParametersException('Invalid limit'); 52 throw new ApiBadParametersException('Invalid limit');
diff --git a/application/api/controllers/Links.php b/application/api/controllers/Links.php
index eb78dd26..3a9c0355 100644
--- a/application/api/controllers/Links.php
+++ b/application/api/controllers/Links.php
@@ -59,9 +59,9 @@ class Links extends ApiController
59 $limit = $request->getParam('limit'); 59 $limit = $request->getParam('limit');
60 if (empty($limit)) { 60 if (empty($limit)) {
61 $limit = self::$DEFAULT_LIMIT; 61 $limit = self::$DEFAULT_LIMIT;
62 } else if (ctype_digit($limit)) { 62 } elseif (ctype_digit($limit)) {
63 $limit = intval($limit); 63 $limit = intval($limit);
64 } else if ($limit === 'all') { 64 } elseif ($limit === 'all') {
65 $limit = count($links); 65 $limit = count($links);
66 } else { 66 } else {
67 throw new ApiBadParametersException('Invalid limit'); 67 throw new ApiBadParametersException('Invalid limit');