@@ -1,2 +1,2 @@ |
||
| 1 | 1 | <?php |
| 2 | -require $_SERVER['APP_DIR'] . '/application/app.php'; |
|
| 3 | 2 | \ No newline at end of file |
| 3 | +require $_SERVER['APP_DIR'].'/application/app.php'; |
|
| 4 | 4 | \ No newline at end of file |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 | { |
| 8 | 8 | public function createApplication() |
| 9 | 9 | { |
| 10 | - $app = require $_SERVER['APP_DIR'] . '/src/app.php'; |
|
| 10 | + $app = require $_SERVER['APP_DIR'].'/src/app.php'; |
|
| 11 | 11 | |
| 12 | 12 | return $app; |
| 13 | 13 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | { |
| 24 | 24 | $this->db = $db; |
| 25 | 25 | |
| 26 | - if(isset($email)) { |
|
| 26 | + if (isset($email)) { |
|
| 27 | 27 | $this->loadUserByEmail($email); |
| 28 | 28 | } |
| 29 | 29 | } |
@@ -44,8 +44,8 @@ discard block |
||
| 44 | 44 | $result = $stmt->fetchAll(\PDO::FETCH_ASSOC); |
| 45 | 45 | |
| 46 | 46 | // Hydrate model |
| 47 | - if(isset($result[0])) { |
|
| 48 | - foreach($result[0] as $key => $val) { |
|
| 47 | + if (isset($result[0])) { |
|
| 48 | + foreach ($result[0] as $key => $val) { |
|
| 49 | 49 | $this->{$key} = $val; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | $stmt->bindValue(':voting', $voting, \PDO::PARAM_BOOL); |
| 74 | 74 | $stmt->execute(); |
| 75 | 75 | |
| 76 | - if(!$voting) { |
|
| 76 | + if (!$voting) { |
|
| 77 | 77 | $this->db->commit(); |
| 78 | 78 | return; |
| 79 | 79 | } |
@@ -93,10 +93,10 @@ discard block |
||
| 93 | 93 | $this->db->commit(); |
| 94 | 94 | |
| 95 | 95 | return $userId; |
| 96 | - } catch(\PDOException $e) { |
|
| 96 | + } catch (\PDOException $e) { |
|
| 97 | 97 | $this->db->rollback(); |
| 98 | 98 | |
| 99 | - throw new \Exception('There was a problem saving this user: ' . $e->getMessage()); |
|
| 99 | + throw new \Exception('There was a problem saving this user: '.$e->getMessage()); |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | \ No newline at end of file |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | { |
| 9 | 9 | public static function generateAssets() |
| 10 | 10 | { |
| 11 | - switch(APP_ENV) { |
|
| 11 | + switch (APP_ENV) { |
|
| 12 | 12 | case 'DEVELOPMENT': |
| 13 | 13 | $env = '.dev'; |
| 14 | 14 | break; |
@@ -22,6 +22,6 @@ discard block |
||
| 22 | 22 | break; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - return file_get_contents(__DIR__ . '/../../../assets/spa/index'.$env.'.html'); |
|
| 25 | + return file_get_contents(__DIR__.'/../../../assets/spa/index'.$env.'.html'); |
|
| 26 | 26 | } |
| 27 | 27 | } |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | { |
| 6 | 6 | public function __construct($emulatePrepares = false) |
| 7 | 7 | { |
| 8 | - parent::__construct('mysql:host=' . MYSQL_HOST . ';dbname=' . MYSQL_DATABASE . ';charset=utf8', MYSQL_USER, MYSQL_PASSWORD); |
|
| 8 | + parent::__construct('mysql:host='.MYSQL_HOST.';dbname='.MYSQL_DATABASE.';charset=utf8', MYSQL_USER, MYSQL_PASSWORD); |
|
| 9 | 9 | |
| 10 | 10 | $this->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); |
| 11 | 11 | $this->setAttribute(\PDO::ATTR_EMULATE_PREPARES, $emulatePrepares); |
@@ -14,9 +14,9 @@ discard block |
||
| 14 | 14 | public static function bindParamArray($prefix, $values, &$bindArray) |
| 15 | 15 | { |
| 16 | 16 | $str = ''; |
| 17 | - foreach($values as $index => $value){ |
|
| 18 | - $str .= ':' . $prefix . $index . ','; |
|
| 19 | - $bindArray[$prefix . $index] = $value; |
|
| 17 | + foreach ($values as $index => $value) { |
|
| 18 | + $str .= ':'.$prefix.$index.','; |
|
| 19 | + $bindArray[$prefix.$index] = $value; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | return rtrim($str, ','); |
@@ -1,4 +1,4 @@ |
||
| 1 | 1 | <?php |
| 2 | -require __DIR__ . '/bootstrap.php'; |
|
| 2 | +require __DIR__.'/bootstrap.php'; |
|
| 3 | 3 | |
| 4 | 4 | return $app; |
| 5 | 5 | \ No newline at end of file |
@@ -1,9 +1,9 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | // Require config loader |
| 3 | -require_once __DIR__ . '/config-loader.php'; |
|
| 3 | +require_once __DIR__.'/config-loader.php'; |
|
| 4 | 4 | |
| 5 | 5 | // Composer autoloader |
| 6 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
| 6 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
| 7 | 7 | |
| 8 | 8 | use Silex\Application; |
| 9 | 9 | use Symfony\Component\HttpFoundation\Request; |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | // Set character encoding |
| 28 | 28 | $app['charset'] = 'UTF-8'; |
| 29 | 29 | |
| 30 | -if(DEBUG) { |
|
| 30 | +if (DEBUG) { |
|
| 31 | 31 | error_reporting(E_ALL); |
| 32 | 32 | ini_set('display_errors', 1); |
| 33 | 33 | $app['debug'] = true; |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | // Error handler |
| 50 | 50 | $app->error(function(\Exception $e, $code) use ($app) { |
| 51 | - if($app['debug']) return; |
|
| 51 | + if ($app['debug']) return; |
|
| 52 | 52 | |
| 53 | - switch($code) { |
|
| 53 | + switch ($code) { |
|
| 54 | 54 | case 404: |
| 55 | 55 | return $app->redirect('/'); |
| 56 | 56 | break; |
@@ -64,6 +64,6 @@ discard block |
||
| 64 | 64 | }); |
| 65 | 65 | |
| 66 | 66 | // Load routes |
| 67 | -foreach(glob(__DIR__ . "/src/Kineo/Route/*.php") as $filename) { |
|
| 67 | +foreach (glob(__DIR__."/src/Kineo/Route/*.php") as $filename) { |
|
| 68 | 68 | require_once $filename; |
| 69 | 69 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | // Import application config |
| 3 | -switch(getenv('env')) { |
|
| 3 | +switch (getenv('env')) { |
|
| 4 | 4 | case 'test': |
| 5 | 5 | $configFile = 'config-test.ini'; |
| 6 | 6 | break; |
@@ -14,8 +14,8 @@ discard block |
||
| 14 | 14 | $configFile = 'config.ini'; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | -$iniArray = parse_ini_file(__DIR__ . DIRECTORY_SEPARATOR . $configFile); |
|
| 17 | +$iniArray = parse_ini_file(__DIR__.DIRECTORY_SEPARATOR.$configFile); |
|
| 18 | 18 | |
| 19 | -foreach($iniArray as $key => $val) { |
|
| 19 | +foreach ($iniArray as $key => $val) { |
|
| 20 | 20 | define($key, $val); |
| 21 | 21 | } |
| 22 | 22 | \ No newline at end of file |