@@ -12,8 +12,8 @@ |
||
| 12 | 12 | |
| 13 | 13 | public function actionIndex() |
| 14 | 14 | { |
| 15 | - echo 'This is sample console command.' . PHP_EOL; |
|
| 16 | - echo 'Actions: ' . PHP_EOL; |
|
| 17 | - echo 'partisan sample index' . PHP_EOL; |
|
| 15 | + echo 'This is sample console command.'.PHP_EOL; |
|
| 16 | + echo 'Actions: '.PHP_EOL; |
|
| 17 | + echo 'partisan sample index'.PHP_EOL; |
|
| 18 | 18 | } |
| 19 | 19 | } |
@@ -8,14 +8,14 @@ discard block |
||
| 8 | 8 | // monolog settings |
| 9 | 9 | 'logger' => [ |
| 10 | 10 | 'name' => 'app', |
| 11 | - 'path' => __DIR__ . '/../log/app.log', |
|
| 11 | + 'path' => __DIR__.'/../log/app.log', |
|
| 12 | 12 | 'level' => Monolog\Logger::DEBUG, |
| 13 | 13 | ], |
| 14 | 14 | |
| 15 | - 'mailTemplate' => __DIR__ . '/../mail', |
|
| 15 | + 'mailTemplate' => __DIR__.'/../mail', |
|
| 16 | 16 | |
| 17 | 17 | // DB |
| 18 | - 'database' => require(__DIR__ . '/../config/db.php'), |
|
| 18 | + 'database' => require(__DIR__.'/../config/db.php'), |
|
| 19 | 19 | |
| 20 | 20 | // ACL |
| 21 | 21 | 'acl' => [ |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * specified here so can be used in the code if needs be |
| 31 | 31 | * Example: ['user' => null] |
| 32 | 32 | */ |
| 33 | - 'resources' => [ ], |
|
| 33 | + 'resources' => [], |
|
| 34 | 34 | // where we specify the guarding! |
| 35 | 35 | 'guards' => [ |
| 36 | 36 | /** |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * if included all resources default to deny unless specified. |
| 40 | 40 | * Example: ['user', ['admin']] |
| 41 | 41 | */ |
| 42 | - 'resources' => [ ], |
|
| 42 | + 'resources' => [], |
|
| 43 | 43 | /** |
| 44 | 44 | * list of literal routes for guarding. |
| 45 | 45 | * optional |
@@ -48,8 +48,8 @@ discard block |
||
| 48 | 48 | * ['route', ['roles'], ['methods',' methods1']] |
| 49 | 49 | */ |
| 50 | 50 | 'routes' => [ |
| 51 | - ['/api/token', ['guest'], ['post']], |
|
| 52 | - ['/api/user', ['user'], ['get']], |
|
| 51 | + ['/api/token', ['guest'], ['post']], |
|
| 52 | + ['/api/user', ['user'], ['get']], |
|
| 53 | 53 | ], |
| 54 | 54 | /** |
| 55 | 55 | * list of callables to resolve against |
@@ -59,15 +59,15 @@ discard block |
||
| 59 | 59 | * ['callable', ['roles']] |
| 60 | 60 | */ |
| 61 | 61 | 'callables' => [ |
| 62 | - ['App\Controller\CrudController', ['user']], |
|
| 63 | - ['App\Controller\CrudController:actionIndex', ['user']], |
|
| 64 | - ['App\Controller\CrudController:actionGet', ['user']], |
|
| 62 | + ['App\Controller\CrudController', ['user']], |
|
| 63 | + ['App\Controller\CrudController:actionIndex', ['user']], |
|
| 64 | + ['App\Controller\CrudController:actionGet', ['user']], |
|
| 65 | 65 | ['App\Controller\CrudController:actionCreate', ['user']], |
| 66 | 66 | ['App\Controller\CrudController:actionUpdate', ['user']], |
| 67 | 67 | ['App\Controller\CrudController:actionDelete', ['user']], |
| 68 | 68 | |
| 69 | - ['App\Controller\UserController:actionIndex', ['user']], |
|
| 70 | - ['App\Controller\UserController:actionGet', ['user']], |
|
| 69 | + ['App\Controller\UserController:actionIndex', ['user']], |
|
| 70 | + ['App\Controller\UserController:actionGet', ['user']], |
|
| 71 | 71 | ['App\Controller\UserController:actionCreate', ['admin']], |
| 72 | 72 | ['App\Controller\UserController:actionUpdate', ['admin']], |
| 73 | 73 | ['App\Controller\UserController:actionDelete', ['admin']], |
@@ -91,10 +91,10 @@ discard block |
||
| 91 | 91 | ], |
| 92 | 92 | |
| 93 | 93 | 'translate' => [ |
| 94 | - 'path' => __DIR__ . '/../lang', |
|
| 94 | + 'path' => __DIR__.'/../lang', |
|
| 95 | 95 | 'locale' => 'ru', |
| 96 | 96 | ], |
| 97 | 97 | |
| 98 | - 'params' => require(__DIR__ . '/../config/params.php'), |
|
| 98 | + 'params' => require(__DIR__.'/../config/params.php'), |
|
| 99 | 99 | ], |
| 100 | 100 | ]; |
@@ -42,12 +42,12 @@ |
||
| 42 | 42 | * |
| 43 | 43 | * @return string |
| 44 | 44 | */ |
| 45 | - public static function generateRandomString($length=32) |
|
| 45 | + public static function generateRandomString($length = 32) |
|
| 46 | 46 | { |
| 47 | 47 | $chars = 'abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ023456789'; |
| 48 | 48 | $charsCount = strlen($chars); |
| 49 | 49 | |
| 50 | - srand((double)microtime()*1000000); |
|
| 50 | + srand((double)microtime() * 1000000); |
|
| 51 | 51 | $i = 1; |
| 52 | 52 | $token = ''; |
| 53 | 53 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | public function __construct($templatePath = '', $attributes = []) |
| 23 | 23 | { |
| 24 | - $this->templatePath = rtrim($templatePath, '/\\') . '/'; |
|
| 24 | + $this->templatePath = rtrim($templatePath, '/\\').'/'; |
|
| 25 | 25 | $this->attributes = $attributes; |
| 26 | 26 | } |
| 27 | 27 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | throw new \InvalidArgumentException('Duplicate template key found'); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - if (!is_file($this->templatePath . $template)) { |
|
| 43 | + if (!is_file($this->templatePath.$template)) { |
|
| 44 | 44 | throw new \RuntimeException('View cannot render `$template` because the template does not exist'); |
| 45 | 45 | } |
| 46 | 46 | |
@@ -48,12 +48,12 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | try { |
| 50 | 50 | ob_start(); |
| 51 | - $this->protectedIncludeScope($this->templatePath . $template, $data); |
|
| 51 | + $this->protectedIncludeScope($this->templatePath.$template, $data); |
|
| 52 | 52 | $output = ob_get_clean(); |
| 53 | - } catch(\Throwable $e) { // PHP 7+ |
|
| 53 | + } catch (\Throwable $e) { // PHP 7+ |
|
| 54 | 54 | ob_end_clean(); |
| 55 | 55 | throw $e; |
| 56 | - } catch(\Exception $e) { // PHP < 7 |
|
| 56 | + } catch (\Exception $e) { // PHP < 7 |
|
| 57 | 57 | ob_end_clean(); |
| 58 | 58 | throw $e; |
| 59 | 59 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * @param string $template |
| 66 | 66 | * @param array $data |
| 67 | 67 | */ |
| 68 | - protected function protectedIncludeScope ($template, array $data) |
|
| 68 | + protected function protectedIncludeScope($template, array $data) |
|
| 69 | 69 | { |
| 70 | 70 | extract($data); |
| 71 | 71 | include $template; |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | { |
| 17 | 17 | $config = $container['settings']['acl']; |
| 18 | 18 | |
| 19 | - $container['acl'] = function (Container $c) use ($config) { |
|
| 19 | + $container['acl'] = function(Container $c) use ($config) { |
|
| 20 | 20 | $acl = new Acl($config); |
| 21 | 21 | |
| 22 | 22 | return $acl; |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | { |
| 16 | 16 | $config = $container['settings']; |
| 17 | 17 | |
| 18 | - $container['mailer'] = function (Container $c) use ($config) { |
|
| 18 | + $container['mailer'] = function(Container $c) use ($config) { |
|
| 19 | 19 | $transport = \Swift_MailTransport::newInstance(); |
| 20 | 20 | $mailer = \Swift_Mailer::newInstance($transport); |
| 21 | 21 | |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | { |
| 19 | 19 | $config = $container['settings']['logger']; |
| 20 | 20 | |
| 21 | - $container['logger'] = function (Container $c) use ($config) { |
|
| 21 | + $container['logger'] = function(Container $c) use ($config) { |
|
| 22 | 22 | $logger = new Logger($config['name']); |
| 23 | 23 | $logger->pushProcessor(new UidProcessor()); |
| 24 | 24 | $logger->pushHandler(new StreamHandler($config['path'], $config['level'])); |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | public function register(Container $container) |
| 16 | 16 | { |
| 17 | - $container['errorHandler'] = function (Container $c) { |
|
| 17 | + $container['errorHandler'] = function(Container $c) { |
|
| 18 | 18 | return function($request, $response, $exception) use ($c) { |
| 19 | 19 | $details = (defined('DEBUG_MODE') && DEBUG_MODE == 1) ? $exception->getMessage() : 'Internal server error'; |
| 20 | 20 | $e = new JsonException(null, 500, 'Internal server error', $details); |
@@ -23,13 +23,13 @@ discard block |
||
| 23 | 23 | }; |
| 24 | 24 | }; |
| 25 | 25 | |
| 26 | - $container['notAllowedHandler'] = function (Container $c) { |
|
| 26 | + $container['notAllowedHandler'] = function(Container $c) { |
|
| 27 | 27 | return function($request, $response, $methods) use ($c) { |
| 28 | 28 | throw new JsonException(null, 405, 'Method Not Allowed', 'Method must be one of: '.implode(', ', $methods)); |
| 29 | 29 | }; |
| 30 | 30 | }; |
| 31 | 31 | |
| 32 | - $container['notFoundHandler'] = function (Container $c) { |
|
| 32 | + $container['notFoundHandler'] = function(Container $c) { |
|
| 33 | 33 | return function() use ($c) { |
| 34 | 34 | throw new JsonException(null, 404, 'Not found', 'Entity not found'); |
| 35 | 35 | }; |
@@ -17,13 +17,13 @@ |
||
| 17 | 17 | { |
| 18 | 18 | $config = $container['settings']; |
| 19 | 19 | |
| 20 | - $container['renderer'] = function (Container $c) use ($config) { |
|
| 20 | + $container['renderer'] = function(Container $c) use ($config) { |
|
| 21 | 21 | $renderer = new Renderer($config); |
| 22 | 22 | |
| 23 | 23 | return $renderer; |
| 24 | 24 | }; |
| 25 | 25 | |
| 26 | - $container['mailRenderer'] = function (Container $c) use ($config) { |
|
| 26 | + $container['mailRenderer'] = function(Container $c) use ($config) { |
|
| 27 | 27 | $renderer = new MailRenderer($config['mailTemplate']); |
| 28 | 28 | |
| 29 | 29 | return $renderer; |