@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | /* database connection */ |
7 | 7 | |
8 | 8 | |
9 | -$container['db'] = function ($container) { |
|
9 | +$container['db'] = function($container) { |
|
10 | 10 | $db = $container['settings']['db']; |
11 | 11 | $pdo = new PDO("mysql:host=" . $db['host'] . ";dbname=" . $db['database'], |
12 | 12 | $db['username'], $db['password']); |
@@ -18,19 +18,19 @@ discard block |
||
18 | 18 | // |
19 | 19 | |
20 | 20 | |
21 | -$container['generalErrorHandler'] = function ($container) { |
|
21 | +$container['generalErrorHandler'] = function($container) { |
|
22 | 22 | return new \Core\Handlers\GeneralErrorHandler($container); |
23 | 23 | }; |
24 | 24 | |
25 | 25 | |
26 | 26 | |
27 | 27 | // Service factory for the ORM |
28 | -$container['validator'] = function () { |
|
28 | +$container['validator'] = function() { |
|
29 | 29 | return new App\Validation\Validator(); |
30 | 30 | }; |
31 | 31 | |
32 | 32 | |
33 | -$container['eloquent'] = function ($container) { |
|
33 | +$container['eloquent'] = function($container) { |
|
34 | 34 | $capsule = new \Illuminate\Database\Capsule\Manager; |
35 | 35 | $capsule->addConnection($container['settings']['db']); |
36 | 36 | $capsule->setAsGlobal(); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | |
50 | 50 | // monolog |
51 | -$container['logger'] = function ($c) { |
|
51 | +$container['logger'] = function($c) { |
|
52 | 52 | $settings = $c->get('settings')['logger']; |
53 | 53 | $logger = new Monolog\Logger($settings['name']); |
54 | 54 | $logger->pushProcessor(new Monolog\Processor\UidProcessor()); |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | }; |
58 | 58 | |
59 | 59 | // Register Blade View helper |
60 | -$container['view'] = function ($container) { |
|
60 | +$container['view'] = function($container) { |
|
61 | 61 | |
62 | 62 | $messages = $container->flash->getMessages(); |
63 | 63 | |
64 | 64 | $viewSettings = $container['settings']['view']; |
65 | 65 | return new \Slim\Views\Blade( |
66 | - [$viewSettings['blade_template_path'].$viewSettings['template']], |
|
66 | + [$viewSettings['blade_template_path'] . $viewSettings['template']], |
|
67 | 67 | $viewSettings['blade_cache_path'], |
68 | 68 | null, |
69 | 69 | [ |
@@ -76,13 +76,13 @@ discard block |
||
76 | 76 | $translator = new \Core\Translator\Translator($container); |
77 | 77 | $translator->init(); |
78 | 78 | |
79 | -$container['translator'] = function () use ($translator) { |
|
79 | +$container['translator'] = function() use ($translator) { |
|
80 | 80 | return $translator; |
81 | 81 | }; |
82 | 82 | |
83 | 83 | |
84 | 84 | // Register provider |
85 | -$container['flash'] = function () { |
|
85 | +$container['flash'] = function() { |
|
86 | 86 | return new \Slim\Flash\Messages(); |
87 | 87 | }; |
88 | 88 | |
@@ -97,14 +97,14 @@ discard block |
||
97 | 97 | |
98 | 98 | |
99 | 99 | /*Dynamic containers in services*/ |
100 | -$dir = scandir(__APP_ROOT__.'/core/Services/'); |
|
100 | +$dir = scandir(__APP_ROOT__ . '/core/Services/'); |
|
101 | 101 | $ex_folders = array('..', '.'); |
102 | -$filesInServices = array_diff($dir,$ex_folders); |
|
102 | +$filesInServices = array_diff($dir, $ex_folders); |
|
103 | 103 | |
104 | -foreach($filesInServices as $service){ |
|
105 | - $content = preg_replace('/.php/','',$service); |
|
106 | - $container[$content] = function () use ($content){ |
|
107 | - $class = '\\Core\\Services\\'.$content ; |
|
104 | +foreach ($filesInServices as $service) { |
|
105 | + $content = preg_replace('/.php/', '', $service); |
|
106 | + $container[$content] = function() use ($content){ |
|
107 | + $class = '\\Core\\Services\\' . $content; |
|
108 | 108 | return new $class(); |
109 | 109 | }; |
110 | 110 | } |
@@ -11,11 +11,11 @@ |
||
11 | 11 | |
12 | 12 | class Env |
13 | 13 | { |
14 | - public function __invoke($filePath ,$key, $default = null) |
|
14 | + public function __invoke($filePath, $key, $default = null) |
|
15 | 15 | { |
16 | 16 | |
17 | 17 | if (file_exists($filePath . '/.env')) { |
18 | - $_dotenv = new Dotenv($filePath ); |
|
18 | + $_dotenv = new Dotenv($filePath); |
|
19 | 19 | $_dotenv->load(); |
20 | 20 | unset($_dotenv); |
21 | 21 | }else { |
@@ -18,7 +18,7 @@ |
||
18 | 18 | $_dotenv = new Dotenv($filePath ); |
19 | 19 | $_dotenv->load(); |
20 | 20 | unset($_dotenv); |
21 | - }else { |
|
21 | + } else { |
|
22 | 22 | return ''; |
23 | 23 | } |
24 | 24 |
@@ -8,15 +8,15 @@ discard block |
||
8 | 8 | |
9 | 9 | namespace Core\Helpers; |
10 | 10 | |
11 | -class Hash{ |
|
11 | +class Hash { |
|
12 | 12 | /** |
13 | 13 | * Receives a string password and hashes it. |
14 | 14 | * |
15 | 15 | * @param string $password |
16 | 16 | * @return string $hash |
17 | 17 | */ |
18 | - public static function hash($password){ |
|
19 | - return (string)password_hash($password, PASSWORD_DEFAULT); |
|
18 | + public static function hash($password) { |
|
19 | + return (string) password_hash($password, PASSWORD_DEFAULT); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | * @param string $hash |
27 | 27 | * @return boolean If the hash was generated from the password |
28 | 28 | */ |
29 | - public static function checkHash($string, $hash){ |
|
30 | - if( password_verify( $string, $hash ) ){ |
|
29 | + public static function checkHash($string, $hash) { |
|
30 | + if (password_verify($string, $hash)) { |
|
31 | 31 | return true; |
32 | 32 | } |
33 | 33 | return false; |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | abstract class _TranslateHandler |
15 | 15 | { |
16 | - protected $container ; |
|
16 | + protected $container; |
|
17 | 17 | protected $local; |
18 | 18 | |
19 | 19 | function __construct(ContainerInterface $container) |
@@ -39,5 +39,5 @@ discard block |
||
39 | 39 | return $this->container; |
40 | 40 | } |
41 | 41 | |
42 | - abstract public function trans(string $key , array $replace); |
|
42 | + abstract public function trans(string $key, array $replace); |
|
43 | 43 | } |
44 | 44 | \ No newline at end of file |