summaryrefslogtreecommitdiff
path: root/app/Core
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-10-17 10:09:03 -0400
committerFrederic Guillot <fred@kanboard.net>2015-10-17 10:09:03 -0400
commit8c532efd5f02f7a7e5ea322a07ddcf49d130a8ec (patch)
tree289222e21420b8d0092f06de097090f179202f6b /app/Core
parentb40190ee9fd557d86e594208ed77fa762c7dcfb7 (diff)
Run php-cs-fixer on the code base
Diffstat (limited to 'app/Core')
-rw-r--r--app/Core/Csv.php6
-rw-r--r--app/Core/DateParser.php3
-rw-r--r--app/Core/HttpClient.php3
-rw-r--r--app/Core/Lexer.php3
-rw-r--r--app/Core/Mail/Client.php2
-rw-r--r--app/Core/Mail/Transport/Mail.php4
-rw-r--r--app/Core/Markdown.php1
-rw-r--r--app/Core/OAuth2.php1
-rw-r--r--app/Core/Paginator.php6
-rw-r--r--app/Core/Plugin/Base.php2
-rw-r--r--app/Core/Plugin/Loader.php4
-rw-r--r--app/Core/Request.php7
-rw-r--r--app/Core/Response.php3
-rw-r--r--app/Core/Router.php10
-rw-r--r--app/Core/Security.php5
-rw-r--r--app/Core/Template.php3
-rw-r--r--app/Core/Tool.php14
-rw-r--r--app/Core/Translator.php3
18 files changed, 24 insertions, 56 deletions
diff --git a/app/Core/Csv.php b/app/Core/Csv.php
index 37f51b27..7c6a4620 100644
--- a/app/Core/Csv.php
+++ b/app/Core/Csv.php
@@ -93,7 +93,8 @@ class Csv
{
if (! empty($value)) {
$value = trim(strtolower($value));
- return $value === '1' || $value{0} === 't' ? 1 : 0;
+ return $value === '1' || $value{0}
+ === 't' ? 1 : 0;
}
return 0;
@@ -187,8 +188,7 @@ class Csv
foreach ($this->columns as $sql_name => $csv_name) {
if (isset($row[$index])) {
$line[$sql_name] = $row[$index];
- }
- else {
+ } else {
$line[$sql_name] = '';
}
diff --git a/app/Core/DateParser.php b/app/Core/DateParser.php
index 026cf305..6577af0f 100644
--- a/app/Core/DateParser.php
+++ b/app/Core/DateParser.php
@@ -214,8 +214,7 @@ class DateParser extends Base
foreach ($fields as $field) {
if (! empty($values[$field])) {
$values[$field] = date($format, $values[$field]);
- }
- else {
+ } else {
$values[$field] = '';
}
}
diff --git a/app/Core/HttpClient.php b/app/Core/HttpClient.php
index 4ec5396e..7f4ea47a 100644
--- a/app/Core/HttpClient.php
+++ b/app/Core/HttpClient.php
@@ -131,8 +131,7 @@ class HttpClient extends Base
if (is_resource($stream)) {
$response = stream_get_contents($stream);
- }
- else {
+ } else {
$this->container['logger']->error('HttpClient: request failed');
}
diff --git a/app/Core/Lexer.php b/app/Core/Lexer.php
index 92443c2c..ca2ef895 100644
--- a/app/Core/Lexer.php
+++ b/app/Core/Lexer.php
@@ -60,7 +60,6 @@ class Lexer
$this->offset = 0;
while (isset($input[$this->offset])) {
-
$result = $this->match(substr($input, $this->offset));
if ($result === false) {
@@ -84,7 +83,6 @@ class Lexer
{
foreach ($this->tokenMap as $pattern => $name) {
if (preg_match($pattern, $string, $matches)) {
-
$this->offset += strlen($matches[1]);
return array(
@@ -113,7 +111,6 @@ class Lexer
);
while (false !== ($token = current($tokens))) {
-
switch ($token['token']) {
case 'T_ASSIGNEE':
case 'T_COLOR':
diff --git a/app/Core/Mail/Client.php b/app/Core/Mail/Client.php
index c7cfaab9..52caef73 100644
--- a/app/Core/Mail/Client.php
+++ b/app/Core/Mail/Client.php
@@ -87,7 +87,7 @@ class Client extends Base
{
$container = $this->container;
- $this->transports[$transport] = function() use ($class, $container) {
+ $this->transports[$transport] = function () use ($class, $container) {
return new $class($container);
};
diff --git a/app/Core/Mail/Transport/Mail.php b/app/Core/Mail/Transport/Mail.php
index ca06e208..4d833f8f 100644
--- a/app/Core/Mail/Transport/Mail.php
+++ b/app/Core/Mail/Transport/Mail.php
@@ -30,7 +30,6 @@ class Mail extends Base implements ClientInterface
public function sendEmail($email, $name, $subject, $html, $author)
{
try {
-
$message = Swift_Message::newInstance()
->setSubject($subject)
->setFrom(array(MAIL_FROM => $author))
@@ -38,8 +37,7 @@ class Mail extends Base implements ClientInterface
->setTo(array($email => $name));
Swift_Mailer::newInstance($this->getTransport())->send($message);
- }
- catch (Swift_TransportException $e) {
+ } catch (Swift_TransportException $e) {
$this->logger->error($e->getMessage());
}
}
diff --git a/app/Core/Markdown.php b/app/Core/Markdown.php
index 4101a3b3..f08c486a 100644
--- a/app/Core/Markdown.php
+++ b/app/Core/Markdown.php
@@ -29,7 +29,6 @@ class Markdown extends Parsedown
{
// Replace task #123 by a link to the task
if (! empty($this->link) && preg_match('!#(\d+)!i', $Excerpt['text'], $matches)) {
-
$url = $this->helper->href(
$this->link['controller'],
$this->link['action'],
diff --git a/app/Core/OAuth2.php b/app/Core/OAuth2.php
index ee6a7837..a5bbba1a 100644
--- a/app/Core/OAuth2.php
+++ b/app/Core/OAuth2.php
@@ -86,7 +86,6 @@ class OAuth2 extends Base
public function getAccessToken($code)
{
if (empty($this->accessToken) && ! empty($code)) {
-
$params = array(
'code' => $code,
'client_id' => $this->clientId,
diff --git a/app/Core/Paginator.php b/app/Core/Paginator.php
index 763cb8b9..cfe89938 100644
--- a/app/Core/Paginator.php
+++ b/app/Core/Paginator.php
@@ -355,8 +355,7 @@ class Paginator
$this->action,
$this->getUrlParams($this->page - 1, $this->order, $this->direction)
);
- }
- else {
+ } else {
$html .= '&larr; '.t('Previous');
}
@@ -382,8 +381,7 @@ class Paginator
$this->action,
$this->getUrlParams($this->page + 1, $this->order, $this->direction)
);
- }
- else {
+ } else {
$html .= t('Next').' &rarr;';
}
diff --git a/app/Core/Plugin/Base.php b/app/Core/Plugin/Base.php
index e38ffee8..15265370 100644
--- a/app/Core/Plugin/Base.php
+++ b/app/Core/Plugin/Base.php
@@ -51,7 +51,7 @@ abstract class Base extends \Kanboard\Core\Base
{
$container = $this->container;
- $this->container['dispatcher']->addListener($event, function() use ($container, $callback) {
+ $this->container['dispatcher']->addListener($event, function () use ($container, $callback) {
call_user_func($callback, $container);
});
}
diff --git a/app/Core/Plugin/Loader.php b/app/Core/Plugin/Loader.php
index ea512c4e..e68ba8e6 100644
--- a/app/Core/Plugin/Loader.php
+++ b/app/Core/Plugin/Loader.php
@@ -94,7 +94,6 @@ class Loader extends \Kanboard\Core\Base
$current_version = $this->getSchemaVersion($plugin);
try {
-
$this->db->startTransaction();
$this->db->getDriver()->disableForeignKeys();
@@ -109,8 +108,7 @@ class Loader extends \Kanboard\Core\Base
$this->db->getDriver()->enableForeignKeys();
$this->db->closeTransaction();
$this->setSchemaVersion($plugin, $i - 1);
- }
- catch (PDOException $e) {
+ } catch (PDOException $e) {
$this->db->cancelTransaction();
$this->db->getDriver()->enableForeignKeys();
die('Unable to migrate schema for the plugin: '.$plugin.' => '.$e->getMessage());
diff --git a/app/Core/Request.php b/app/Core/Request.php
index f553d7cd..5eda2d02 100644
--- a/app/Core/Request.php
+++ b/app/Core/Request.php
@@ -218,11 +218,8 @@ class Request
);
foreach ($keys as $key) {
-
if (isset($_SERVER[$key])) {
-
foreach (explode(',', $_SERVER[$key]) as $ip_address) {
-
$ip_address = trim($ip_address);
if ($only_public) {
@@ -231,9 +228,7 @@ class Request
if (filter_var($ip_address, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false) {
return $ip_address;
}
- }
- else {
-
+ } else {
return $ip_address;
}
}
diff --git a/app/Core/Response.php b/app/Core/Response.php
index c27f0a1d..528a6302 100644
--- a/app/Core/Response.php
+++ b/app/Core/Response.php
@@ -68,8 +68,7 @@ class Response
{
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] === 'XMLHttpRequest') {
header('X-Ajax-Redirect: '.$url);
- }
- else {
+ } else {
header('Location: '.$url);
}
diff --git a/app/Core/Router.php b/app/Core/Router.php
index 8f366daf..f4453c71 100644
--- a/app/Core/Router.php
+++ b/app/Core/Router.php
@@ -127,17 +127,13 @@ class Router extends Base
$count = count($parts);
foreach ($this->paths as $route) {
-
if ($count === $route['count']) {
-
$params = array();
for ($i = 0; $i < $count; $i++) {
-
if ($route['pattern'][$i]{0} === ':') {
$params[substr($route['pattern'][$i], 1)] = $parts[$i];
- }
- else if ($route['pattern'][$i] !== $parts[$i]) {
+ } elseif ($route['pattern'][$i] !== $parts[$i]) {
break;
}
}
@@ -168,7 +164,6 @@ class Router extends Base
}
foreach ($this->urls[$controller][$action] as $pattern) {
-
if (array_diff_key($params, $pattern['params']) === array()) {
$url = $pattern['path'];
$i = 0;
@@ -213,8 +208,7 @@ class Router extends Base
$this->controller = $this->sanitize($_GET['controller'], 'app');
$this->action = $this->sanitize($_GET['action'], 'index');
$plugin = ! empty($_GET['plugin']) ? $this->sanitize($_GET['plugin'], '') : '';
- }
- else {
+ } else {
list($this->controller, $this->action) = $this->findRoute($this->getPath($uri, $query_string)); // TODO: add plugin for routes
$plugin = '';
}
diff --git a/app/Core/Security.php b/app/Core/Security.php
index 126de2fd..54207ee1 100644
--- a/app/Core/Security.php
+++ b/app/Core/Security.php
@@ -10,7 +10,7 @@ namespace Kanboard\Core;
*/
class Security
{
- /**
+ /**
* Generate a random token with different methods: openssl or /dev/urandom or fallback to uniqid()
*
* @static
@@ -21,8 +21,7 @@ class Security
{
if (function_exists('openssl_random_pseudo_bytes')) {
return bin2hex(\openssl_random_pseudo_bytes(30));
- }
- else if (ini_get('open_basedir') === '' && strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
+ } elseif (ini_get('open_basedir') === '' && strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
return hash('sha256', file_get_contents('/dev/urandom', false, null, 0, 30));
}
diff --git a/app/Core/Template.php b/app/Core/Template.php
index d1e0c25a..002b20b1 100644
--- a/app/Core/Template.php
+++ b/app/Core/Template.php
@@ -85,8 +85,7 @@ class Template extends Helper
if (strpos($template_name, ':') !== false) {
list($plugin, $template) = explode(':', $template_name);
$path = __DIR__.'/../../plugins/'.ucfirst($plugin).'/Template/'.$template.'.php';
- }
- else {
+ } else {
$path = __DIR__.'/../Template/'.$template_name.'.php';
}
diff --git a/app/Core/Tool.php b/app/Core/Tool.php
index 1bd43a40..247fda1a 100644
--- a/app/Core/Tool.php
+++ b/app/Core/Tool.php
@@ -26,8 +26,8 @@ class Tool
return '';
}
- list($local_part,) = explode('@', $email);
- list(,$identifier) = explode('+', $local_part);
+ list($local_part, ) = explode('@', $email);
+ list(, $identifier) = explode('+', $local_part);
return $identifier;
}
@@ -83,14 +83,11 @@ class Tool
$dst_width = $resize_width;
$dst_height = floor($src_height * ($resize_width / $src_width));
$dst_image = imagecreatetruecolor($dst_width, $dst_height);
- }
- elseif ($resize_width == 0 && $resize_height > 0) {
+ } elseif ($resize_width == 0 && $resize_height > 0) {
$dst_width = floor($src_width * ($resize_height / $src_height));
$dst_height = $resize_height;
$dst_image = imagecreatetruecolor($dst_width, $dst_height);
- }
- else {
-
+ } else {
$src_ratio = $src_width / $src_height;
$resize_ratio = $resize_width / $resize_height;
@@ -99,8 +96,7 @@ class Tool
$dst_height = floor($src_height * ($resize_width / $src_width));
$dst_y = ($dst_height - $resize_height) / 2 * (-1);
- }
- else {
+ } else {
$dst_width = floor($src_width * ($resize_height / $src_height));
$dst_height = $resize_height;
diff --git a/app/Core/Translator.php b/app/Core/Translator.php
index 7dd67363..96a481f6 100644
--- a/app/Core/Translator.php
+++ b/app/Core/Translator.php
@@ -184,8 +184,7 @@ class Translator
{
if (isset(self::$locales[$identifier])) {
return self::$locales[$identifier];
- }
- else {
+ } else {
return $default;
}
}