@@ -34,21 +34,21 @@ discard block |
||
34 | 34 | |
35 | 35 | public function resource($url, $controller, $args = []) |
36 | 36 | { |
37 | - $url = rtrim($url,'/'); |
|
38 | - $routeNames = implode('.',explode('/',trim($url,'/'))); |
|
39 | - |
|
40 | - $this->app->group($url, function () use ($controller,$routeNames, $args) { |
|
41 | - $this->get('', $controller . ':index')->add(self::middleware('index', $args))->setName($routeNames.'.index'); |
|
42 | - $this->get('/', $controller . ':index')->add(self::middleware('index', $args))->setName($routeNames.'.index'); |
|
43 | - $this->get('/index', $controller . ':index')->add(self::middleware('index', $args))->setName($routeNames.'.index'); |
|
44 | - |
|
45 | - $this->get('/create', $controller . ':create')->add(self::middleware('create', $args))->setName($routeNames.'.create'); |
|
46 | - $this->get('/{id:[0-9]+}', $controller . ':show')->add(self::middleware('show', $args))->setName($routeNames.'.show'); |
|
47 | - $this->get('/{id:[0-9]+}/edit', $controller . ':edit')->add(self::middleware('edit', $args))->setName($routeNames.'.edit'); |
|
48 | - $this->post('', $controller . ':store')->add(self::middleware('store', $args))->setName($routeNames.'.store'); |
|
49 | - $this->put('/{id:[0-9]+}', $controller . ':update')->add(self::middleware('update', $args))->setName($routeNames.'.update'); |
|
50 | - $this->patch('/{id:[0-9]+}', $controller . ':update')->add(self::middleware('index', $args))->setName($routeNames.'.update'); |
|
51 | - $this->delete('/{id:[0-9]+}', $controller . ':destroy')->add(self::middleware('destroy', $args))->setName($routeNames.'.destroy'); |
|
37 | + $url = rtrim($url, '/'); |
|
38 | + $routeNames = implode('.', explode('/', trim($url, '/'))); |
|
39 | + |
|
40 | + $this->app->group($url, function() use ($controller, $routeNames, $args) { |
|
41 | + $this->get('', $controller . ':index')->add(self::middleware('index', $args))->setName($routeNames . '.index'); |
|
42 | + $this->get('/', $controller . ':index')->add(self::middleware('index', $args))->setName($routeNames . '.index'); |
|
43 | + $this->get('/index', $controller . ':index')->add(self::middleware('index', $args))->setName($routeNames . '.index'); |
|
44 | + |
|
45 | + $this->get('/create', $controller . ':create')->add(self::middleware('create', $args))->setName($routeNames . '.create'); |
|
46 | + $this->get('/{id:[0-9]+}', $controller . ':show')->add(self::middleware('show', $args))->setName($routeNames . '.show'); |
|
47 | + $this->get('/{id:[0-9]+}/edit', $controller . ':edit')->add(self::middleware('edit', $args))->setName($routeNames . '.edit'); |
|
48 | + $this->post('', $controller . ':store')->add(self::middleware('store', $args))->setName($routeNames . '.store'); |
|
49 | + $this->put('/{id:[0-9]+}', $controller . ':update')->add(self::middleware('update', $args))->setName($routeNames . '.update'); |
|
50 | + $this->patch('/{id:[0-9]+}', $controller . ':update')->add(self::middleware('index', $args))->setName($routeNames . '.update'); |
|
51 | + $this->delete('/{id:[0-9]+}', $controller . ':destroy')->add(self::middleware('destroy', $args))->setName($routeNames . '.destroy'); |
|
52 | 52 | |
53 | 53 | })->add(self::middleware('group', $args)); |
54 | 54 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public static function middleware($middleWare = "group", $args) |
62 | 62 | { |
63 | - $routeResourceMiddleWare_default = function ($request, $response, $next) { |
|
63 | + $routeResourceMiddleWare_default = function($request, $response, $next) { |
|
64 | 64 | return $next($request, $response); |
65 | 65 | }; |
66 | 66 |
@@ -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 |
@@ -8,14 +8,14 @@ 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){ |
|
18 | + public static function hash($password) { |
|
19 | 19 | // return (string)password_hash($password, PASSWORD_DEFAULT); |
20 | 20 | return sha1(md5($password)); |
21 | 21 | } |
@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | * @param string $hash |
28 | 28 | * @return boolean If the hash was generated from the password |
29 | 29 | */ |
30 | - public static function checkHash($string, $hash){ |
|
31 | - if( password_verify( $string, $hash ) ){ |
|
30 | + public static function checkHash($string, $hash) { |
|
31 | + if (password_verify($string, $hash)) { |
|
32 | 32 | return true; |
33 | 33 | } |
34 | 34 | return false; |
@@ -12,7 +12,7 @@ |
||
12 | 12 | { |
13 | 13 | Capsule::schema()->table('users', function($table) |
14 | 14 | { |
15 | - $table->string('password',128); |
|
15 | + $table->string('password', 128); |
|
16 | 16 | }); |
17 | 17 | } |
18 | 18 |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | { |
20 | 20 | $this->container = $container; |
21 | 21 | } |
22 | - public function get( $name, $params = array() ) |
|
22 | + public function get($name, $params = array()) |
|
23 | 23 | { |
24 | - $route = $this->container->get('router')->pathFor($name,$params); |
|
24 | + $route = $this->container->get('router')->pathFor($name, $params); |
|
25 | 25 | |
26 | 26 | |
27 | 27 | return $route; |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | $protocol = $request->getUri()->getScheme(); |
48 | 48 | $baseHost = $request->getUri()->getHost(); |
49 | 49 | $path = $request->getUri()->getPath(); |
50 | - $pathArr = explode('/',$path); |
|
51 | - unset($pathArr[count($pathArr)-1]); |
|
52 | - $path = implode('/',$pathArr); |
|
50 | + $pathArr = explode('/', $path); |
|
51 | + unset($pathArr[count($pathArr) - 1]); |
|
52 | + $path = implode('/', $pathArr); |
|
53 | 53 | $port = $request->getUri()->getPort() ? ':' . $request->getUri()->getPort() : ''; |
54 | 54 | $baseUrl = $protocol . '://' . $baseHost . $port . $path; |
55 | 55 | return $baseUrl; |
@@ -17,7 +17,7 @@ |
||
17 | 17 | { |
18 | 18 | $namespace = 'Core\\Handlers\\Session\\'; |
19 | 19 | |
20 | - $className = $namespace.ucfirst($driver).'Handler'; |
|
20 | + $className = $namespace . ucfirst($driver) . 'Handler'; |
|
21 | 21 | $this->handler = new $className(); |
22 | 22 | |
23 | 23 | return $this->handler; |
@@ -12,16 +12,16 @@ discard block |
||
12 | 12 | class AbstractSession |
13 | 13 | { |
14 | 14 | |
15 | - public function getRecursiveSessionKey($data , $keyArr){ |
|
16 | - $arrayFound = isset($data[$keyArr[0]]) ? $data[$keyArr[0]] : ''; |
|
17 | - if($arrayFound){ |
|
15 | + public function getRecursiveSessionKey($data, $keyArr) { |
|
16 | + $arrayFound = isset($data[$keyArr[0]]) ? $data[$keyArr[0]] : ''; |
|
17 | + if ($arrayFound) { |
|
18 | 18 | unset($keyArr[0]); |
19 | 19 | $keyArr = array_values($keyArr); |
20 | - if(isset($keyArr[0])){ |
|
21 | - return $this->getRecursiveSessionKey($arrayFound,$keyArr); |
|
20 | + if (isset($keyArr[0])) { |
|
21 | + return $this->getRecursiveSessionKey($arrayFound, $keyArr); |
|
22 | 22 | } |
23 | 23 | } |
24 | - return $arrayFound ; |
|
24 | + return $arrayFound; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $sourceRef = &$source; |
34 | 34 | } |
35 | 35 | $keyName = trim($keyName); |
36 | - $sourceRef = &$sourceRef[$keyName]; |
|
36 | + $sourceRef = &$sourceRef[$keyName]; |
|
37 | 37 | } |
38 | 38 | $sourceRef = $value; |
39 | 39 | unset($sourceRef); |
@@ -15,28 +15,28 @@ |
||
15 | 15 | { |
16 | 16 | public function get($key = null) |
17 | 17 | { |
18 | - if(!isset($_SESSION)) return []; |
|
18 | + if (!isset($_SESSION)) return []; |
|
19 | 19 | |
20 | - if(!$key){ |
|
20 | + if (!$key) { |
|
21 | 21 | return $_SESSION; |
22 | - }else{ |
|
23 | - $keys = explode('.',$key); |
|
24 | - $sessionVal = $this->getRecursiveSessionKey($_SESSION,$keys); |
|
22 | + }else { |
|
23 | + $keys = explode('.', $key); |
|
24 | + $sessionVal = $this->getRecursiveSessionKey($_SESSION, $keys); |
|
25 | 25 | return $sessionVal; |
26 | 26 | } |
27 | 27 | } |
28 | 28 | |
29 | - public function set($key,$val) |
|
29 | + public function set($key, $val) |
|
30 | 30 | { |
31 | - $_SESSION = $this->setArr($key,$val); |
|
31 | + $_SESSION = $this->setArr($key, $val); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
35 | - public function exists($key,$val) |
|
35 | + public function exists($key, $val) |
|
36 | 36 | { |
37 | 37 | $keySession = $this->get($key); |
38 | 38 | |
39 | - if($keySession){ |
|
39 | + if ($keySession) { |
|
40 | 40 | return true; |
41 | 41 | } |
42 | 42 | return false; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | */ |
32 | 32 | protected $moduleInstances = []; |
33 | 33 | |
34 | - public function __construct($app, $modules=array()) |
|
34 | + public function __construct($app, $modules = array()) |
|
35 | 35 | { |
36 | 36 | $this->app = $app; |
37 | 37 | // build an class map of [[module => moduleClassPath], ..] |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | } |
93 | 93 | |
94 | 94 | $allSettings['modules'] = array_merge_recursive($allSettings['modules'], $this->getModuleConfig()); |
95 | - $container['settings']->__construct( $allSettings ); |
|
95 | + $container['settings']->__construct($allSettings); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |