@@ -107,7 +107,7 @@ |
||
107 | 107 | $container['view'] = function ($container) { |
108 | 108 | $messages = $container->flash->getMessages(); |
109 | 109 | |
110 | - if(!is_dir('../app/View/cache')){ |
|
110 | + if(!is_dir('../app/View/cache')){ |
|
111 | 111 | @mkdir('../app/View/cache'); |
112 | 112 | } |
113 | 113 |
@@ -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']); |
@@ -26,19 +26,19 @@ discard block |
||
26 | 26 | // |
27 | 27 | |
28 | 28 | |
29 | -$container['generalErrorHandler'] = function ($container) { |
|
29 | +$container['generalErrorHandler'] = function($container) { |
|
30 | 30 | return new \Core\Handlers\GeneralErrorHandler($container); |
31 | 31 | }; |
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | 35 | // Service factory for the ORM |
36 | -$container['validator'] = function () { |
|
36 | +$container['validator'] = function() { |
|
37 | 37 | return new App\Validation\Validator(); |
38 | 38 | }; |
39 | 39 | |
40 | 40 | |
41 | -$container['eloquent'] = function ($container) { |
|
41 | +$container['eloquent'] = function($container) { |
|
42 | 42 | $capsule = new \Illuminate\Database\Capsule\Manager; |
43 | 43 | $capsule->addConnection($container['settings']['db']); |
44 | 44 | $capsule->setAsGlobal(); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | |
58 | 58 | // monolog |
59 | -$container['logger'] = function ($c) { |
|
59 | +$container['logger'] = function($c) { |
|
60 | 60 | $settings = $c->get('settings')['logger']; |
61 | 61 | $logger = new Monolog\Logger($settings['name']); |
62 | 62 | $logger->pushProcessor(new Monolog\Processor\UidProcessor()); |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | }; |
66 | 66 | |
67 | 67 | // not found handler |
68 | -$container['notFoundHandler'] = function ($container) { |
|
69 | - return function (\Slim\Http\Request $request, \Slim\Http\Response $response) use ($container) { |
|
68 | +$container['notFoundHandler'] = function($container) { |
|
69 | + return function(\Slim\Http\Request $request, \Slim\Http\Response $response) use ($container) { |
|
70 | 70 | return $container['view']->render($response->withStatus(404), '404'); |
71 | 71 | }; |
72 | 72 | }; |
@@ -76,23 +76,23 @@ 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 | |
89 | 89 | |
90 | 90 | // |
91 | -$container['session'] = function ($container) { |
|
91 | +$container['session'] = function($container) { |
|
92 | 92 | $setting_session_driver = $container['settings']['session']['driver'] ?? 'session'; |
93 | 93 | |
94 | 94 | $sessionOBJ = new \Core\Services\Session(); |
95 | - $session = $sessionOBJ->init($setting_session_driver) ; |
|
95 | + $session = $sessionOBJ->init($setting_session_driver); |
|
96 | 96 | return $session; |
97 | 97 | }; |
98 | 98 | |
@@ -104,10 +104,10 @@ discard block |
||
104 | 104 | |
105 | 105 | |
106 | 106 | // Register Blade View helper |
107 | -$container['view'] = function ($container) { |
|
107 | +$container['view'] = function($container) { |
|
108 | 108 | $messages = $container->flash->getMessages(); |
109 | 109 | |
110 | - if(!is_dir('../app/View/cache')){ |
|
110 | + if (!is_dir('../app/View/cache')) { |
|
111 | 111 | @mkdir('../app/View/cache'); |
112 | 112 | } |
113 | 113 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $viewSettings = $container['settings']['view']; |
116 | 116 | |
117 | 117 | return new \Slim\Views\Blade( |
118 | - [$viewSettings['blade_template_path'].$viewSettings['template']], |
|
118 | + [$viewSettings['blade_template_path'] . $viewSettings['template']], |
|
119 | 119 | $viewSettings['blade_cache_path'], |
120 | 120 | null, |
121 | 121 | [ |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | }; |
128 | 128 | |
129 | 129 | // Register Blade View helper |
130 | -$container['json'] = function ($container) { |
|
130 | +$container['json'] = function($container) { |
|
131 | 131 | return new \Core\Handlers\JsonHandler(); |
132 | 132 | }; |
133 | 133 | |
134 | -$app->getContainer()['view']->getRenderer()->getCompiler()->directive('helloWorld', function(){ |
|
134 | +$app->getContainer()['view']->getRenderer()->getCompiler()->directive('helloWorld', function() { |
|
135 | 135 | |
136 | 136 | return "<?php echo 'Hello Directive'; ?>"; |
137 | 137 | }); |
@@ -145,14 +145,14 @@ discard block |
||
145 | 145 | |
146 | 146 | |
147 | 147 | /*Dynamic containers in services*/ |
148 | -$dir = scandir(__APP_ROOT__.'/core/Services/'); |
|
148 | +$dir = scandir(__APP_ROOT__ . '/core/Services/'); |
|
149 | 149 | $ex_folders = array('..', '.'); |
150 | -$filesInServices = array_diff($dir,$ex_folders); |
|
150 | +$filesInServices = array_diff($dir, $ex_folders); |
|
151 | 151 | |
152 | -foreach($filesInServices as $service){ |
|
153 | - $content = preg_replace('/.php/','',$service); |
|
154 | - $container[$content] = function () use ($content){ |
|
155 | - $class = '\\Core\\Services\\'.$content ; |
|
152 | +foreach ($filesInServices as $service) { |
|
153 | + $content = preg_replace('/.php/', '', $service); |
|
154 | + $container[$content] = function() use ($content){ |
|
155 | + $class = '\\Core\\Services\\' . $content; |
|
156 | 156 | return new $class(); |
157 | 157 | }; |
158 | 158 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | 'displayErrorDetails' => true, |
13 | 13 | 'addContentLengthHeader' => false, |
14 | 14 | 'determineRouteBeforeAppMiddleware' => true, |
15 | - 'debug'=>true , |
|
15 | + 'debug'=>true, |
|
16 | 16 | 'translation' => [ |
17 | 17 | 'default_lang' => 'en', |
18 | 18 | 'translations_path' => $APPROOT . 'translations/', |
@@ -26,15 +26,15 @@ discard block |
||
26 | 26 | 'path' => __DIR__ . '/../storage/logs/app.log', |
27 | 27 | ], |
28 | 28 | 'db' => [ |
29 | - 'driver' => $env($APPROOT,'DB_DRIVER', 'mysql'), |
|
30 | - 'host' => $env($APPROOT,'DB_HOST', 'localhost'), |
|
31 | - 'database' => $env($APPROOT,'DB_NAME', 'cafesaba'), |
|
32 | - 'username' => $env($APPROOT,'DB_USERNAME', 'root'), |
|
33 | - 'password' => $env($APPROOT,'DB_PASS', ''), |
|
34 | - 'charset' => $env($APPROOT,'DB_CHARSET', 'utf8'), |
|
35 | - 'collation' => $env($APPROOT,'DB_COLLATION', 'utf8_unicode_ci'), |
|
36 | - 'prefix' => $env($APPROOT,'DB_PREFIX', ''), |
|
37 | - 'port' => $env($APPROOT,'DB_PORT', 3306), |
|
29 | + 'driver' => $env($APPROOT, 'DB_DRIVER', 'mysql'), |
|
30 | + 'host' => $env($APPROOT, 'DB_HOST', 'localhost'), |
|
31 | + 'database' => $env($APPROOT, 'DB_NAME', 'cafesaba'), |
|
32 | + 'username' => $env($APPROOT, 'DB_USERNAME', 'root'), |
|
33 | + 'password' => $env($APPROOT, 'DB_PASS', ''), |
|
34 | + 'charset' => $env($APPROOT, 'DB_CHARSET', 'utf8'), |
|
35 | + 'collation' => $env($APPROOT, 'DB_COLLATION', 'utf8_unicode_ci'), |
|
36 | + 'prefix' => $env($APPROOT, 'DB_PREFIX', ''), |
|
37 | + 'port' => $env($APPROOT, 'DB_PORT', 3306), |
|
38 | 38 | ], |
39 | 39 | 'view' => [ |
40 | 40 | 'path' => '../app/View', |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | 'showSlimEnvironmentPanel' => 1, |
55 | 55 | 'showSlimRequestPanel' => 1, |
56 | 56 | 'showSlimResponsePanel' => 1, |
57 | - 'showSlimContainer' =>1 , |
|
57 | + 'showSlimContainer' =>1, |
|
58 | 58 | 'showEloquentORMPanel' => 1, |
59 | - 'showIdiormPanel' => 0,// > 0 mean you enable logging |
|
59 | + 'showIdiormPanel' => 0, // > 0 mean you enable logging |
|
60 | 60 | // but show or not panel you decide in browser in panel selector |
61 | - 'showDoctrinePanel' => 'em',// here also enable logging and you must enter your Doctrine container name |
|
61 | + 'showDoctrinePanel' => 'em', // here also enable logging and you must enter your Doctrine container name |
|
62 | 62 | // and also as above show or not panel you decide in browser in panel selector |
63 | 63 | 'showProfilerPanel' => 1, |
64 | 64 | 'showVendorVersionsPanel' => 1, |
@@ -13,13 +13,13 @@ |
||
13 | 13 | |
14 | 14 | class File extends _Service |
15 | 15 | { |
16 | - public function moveUploadedFile($directory,$fileName, UploadedFile $uploadedFile) |
|
17 | - { |
|
18 | - $extension = pathinfo($uploadedFile->getClientFilename(), PATHINFO_EXTENSION); |
|
19 | - $basename = bin2hex(random_bytes(8)); // see http://php.net/manual/en/function.random-bytes.php |
|
20 | - $filename = sprintf('%s.%0.8s', $fileName, $extension); |
|
21 | - $uploadedFile->moveTo($directory . DIRECTORY_SEPARATOR . $filename); |
|
22 | - return $filename; |
|
23 | - } |
|
16 | + public function moveUploadedFile($directory,$fileName, UploadedFile $uploadedFile) |
|
17 | + { |
|
18 | + $extension = pathinfo($uploadedFile->getClientFilename(), PATHINFO_EXTENSION); |
|
19 | + $basename = bin2hex(random_bytes(8)); // see http://php.net/manual/en/function.random-bytes.php |
|
20 | + $filename = sprintf('%s.%0.8s', $fileName, $extension); |
|
21 | + $uploadedFile->moveTo($directory . DIRECTORY_SEPARATOR . $filename); |
|
22 | + return $filename; |
|
23 | + } |
|
24 | 24 | |
25 | 25 | } |
26 | 26 | \ No newline at end of file |
@@ -13,7 +13,7 @@ |
||
13 | 13 | |
14 | 14 | class File extends _Service |
15 | 15 | { |
16 | - public function moveUploadedFile($directory,$fileName, UploadedFile $uploadedFile) |
|
16 | + public function moveUploadedFile($directory, $fileName, UploadedFile $uploadedFile) |
|
17 | 17 | { |
18 | 18 | $extension = pathinfo($uploadedFile->getClientFilename(), PATHINFO_EXTENSION); |
19 | 19 | $basename = bin2hex(random_bytes(8)); // see http://php.net/manual/en/function.random-bytes.php |
@@ -12,7 +12,7 @@ |
||
12 | 12 | { |
13 | 13 | Capsule::schema()->table('users', function($table) |
14 | 14 | { |
15 | - $table->enum('has_pic',['no','yes'])->default('no'); |
|
15 | + $table->enum('has_pic', ['no', 'yes'])->default('no'); |
|
16 | 16 | }); |
17 | 17 | } |
18 | 18 |