Skip to content

Commit 2954a1c

Browse files
committed
Upgrade
1 parent 72c1c23 commit 2954a1c

16 files changed

+497
-373
lines changed

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "floatphp/kernel",
3-
"version" : "1.3.3",
3+
"version" : "1.4.0",
44
"type": "library",
55
"description": "FloatPHP Kernel Components",
66
"keywords": ["php","micro-framework","framework","PSR","ORM","jakiboy","composer"],
@@ -19,11 +19,11 @@
1919
"ext-intl": "*",
2020
"twig/twig": "^3.14.2",
2121
"justinrainbow/json-schema": "^6.0.0",
22-
"floatphp/classes": "^1.3.0",
23-
"floatphp/helpers": "^1.3.0",
24-
"floatphp/interfaces": "^1.3.0",
25-
"floatphp/exceptions": "^1.3.0",
26-
"floatphp/cli": "^1.3.0"
22+
"floatphp/classes": "^1.4.0",
23+
"floatphp/helpers": "^1.4.0",
24+
"floatphp/interfaces": "^1.4.0",
25+
"floatphp/exceptions": "^1.4.0",
26+
"floatphp/cli": "^1.4.0"
2727
},
2828
"autoload": {
2929
"psr-4" : {

src/AbstractAuthController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @author : Jakiboy
44
* @package : FloatPHP
55
* @subpackage : Kernel Component
6-
* @version : 1.3.x
6+
* @version : 1.4.x
77
* @copyright : (c) 2018 - 2024 Jihad Sinnaour <[email protected]>
88
* @link : https://floatphp.com
99
* @license : MIT

src/ApiController.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @author : Jakiboy
44
* @package : FloatPHP
55
* @subpackage : Kernel Component
6-
* @version : 1.3.x
6+
* @version : 1.4.x
77
* @copyright : (c) 2018 - 2024 Jihad Sinnaour <[email protected]>
88
* @link : https://floatphp.com
99
* @license : MIT
@@ -22,13 +22,9 @@ class ApiController extends BaseController
2222
*
2323
* @access public
2424
* @return bool
25-
* @uses initConfig()
2625
*/
2726
public function isHttpAuthenticated() : bool
2827
{
29-
// Init configuration
30-
$this->initConfig();
31-
3228
// Basic authentication
3329
if ( $this->applyFilter('basic-auth', true) ) {
3430
if ( $this->isBasicAuth() ) {

src/BackendController.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @author : Jakiboy
44
* @package : FloatPHP
55
* @subpackage : Kernel Component
6-
* @version : 1.3.x
6+
* @version : 1.4.x
77
* @copyright : (c) 2018 - 2024 Jihad Sinnaour <[email protected]>
88
* @link : https://floatphp.com
99
* @license : MIT
@@ -25,9 +25,6 @@ class BackendController extends BaseController
2525
*/
2626
public function __construct(array $content = [])
2727
{
28-
// Init configuration
29-
$this->initConfig();
30-
3128
// Set view global content
3229
$id = (int)$this->getSession('userId');
3330
$content = $this->mergeArray([
@@ -49,10 +46,8 @@ public function __construct(array $content = [])
4946
*/
5047
public function hasPermissions($role = false) : bool
5148
{
52-
if ( $this->isPermissions() ) {
53-
if ( $role ) {
54-
return $this->hasRole($role);
55-
}
49+
if ( $this->isPermissions() && $role ) {
50+
return $this->hasRole($role);
5651
}
5752
return true;
5853
}

src/Base.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @author : Jakiboy
44
* @package : FloatPHP
55
* @subpackage : Kernel Component
6-
* @version : 1.3.x
6+
* @version : 1.4.x
77
* @copyright : (c) 2018 - 2024 Jihad Sinnaour <[email protected]>
88
* @link : https://floatphp.com
99
* @license : MIT

src/BaseController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @author : Jakiboy
44
* @package : FloatPHP
55
* @subpackage : Kernel Component
6-
* @version : 1.3.x
6+
* @version : 1.4.x
77
* @copyright : (c) 2018 - 2024 Jihad Sinnaour <[email protected]>
88
* @link : https://floatphp.com
99
* @license : MIT

src/Core.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @author : Jakiboy
44
* @package : FloatPHP
55
* @subpackage : Kernel Component
6-
* @version : 1.3.x
6+
* @version : 1.4.x
77
* @copyright : (c) 2018 - 2024 Jihad Sinnaour <[email protected]>
88
* @link : https://floatphp.com
99
* @license : MIT

src/ErrorController.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @author : Jakiboy
44
* @package : FloatPHP
55
* @subpackage : Kernel Component
6-
* @version : 1.3.x
6+
* @version : 1.4.x
77
* @copyright : (c) 2018 - 2024 Jihad Sinnaour <[email protected]>
88
* @link : https://floatphp.com
99
* @license : MIT
@@ -27,9 +27,6 @@ class ErrorController extends FrontController
2727
*/
2828
public function __construct(int $code = 404, string $error = null, bool $render = true)
2929
{
30-
// Init configuration
31-
$this->initConfig();
32-
3330
$message = $this->applyFilter('error-message', Response::getMessage($code));
3431

3532
if ( !$error ) {
@@ -55,8 +52,5 @@ public function __construct(int $code = 404, string $error = null, bool $render
5552
$args = $this->applyFilter('error-http-args', []);
5653
Response::set($error, $args, 'error', $code);
5754
}
58-
59-
// Reset configuration
60-
$this->resetConfig();
6155
}
6256
}

src/FrontController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @author : Jakiboy
44
* @package : FloatPHP
55
* @subpackage : Kernel Component
6-
* @version : 1.3.x
6+
* @version : 1.4.x
77
* @copyright : (c) 2018 - 2024 Jihad Sinnaour <[email protected]>
88
* @link : https://floatphp.com
99
* @license : MIT

src/Middleware.php

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @author : Jakiboy
44
* @package : FloatPHP
55
* @subpackage : Kernel Component
6-
* @version : 1.3.x
6+
* @version : 1.4.x
77
* @copyright : (c) 2018 - 2024 Jihad Sinnaour <[email protected]>
88
* @link : https://floatphp.com
99
* @license : MIT
@@ -36,9 +36,6 @@ final class Middleware
3636
*/
3737
public function __construct(RouterInterface $router)
3838
{
39-
// Init configuration
40-
$this->initConfig();
41-
4239
// Prepare router from config
4340
$router->setBase($this->getBaseRoute());
4441

@@ -136,7 +133,7 @@ private function doInstance() : void
136133
$class = $this->parseClass();
137134
$method = $this->parseMethod();
138135
$var = $this->parseVar();
139-
$role = $this->parsePermissions();
136+
$role = $this->parsePermission();
140137

141138
// Secure access
142139
$instance = new $class();
@@ -191,7 +188,7 @@ private function doModuleInstance() : void
191188
$class = $this->parseModuleClass();
192189
$method = $this->parseMethod();
193190
$var = $this->parseVar();
194-
$role = $this->parsePermissions();
191+
$role = $this->parsePermission();
195192

196193
// Secure access
197194
$instance = new $class();
@@ -290,7 +287,7 @@ private function isAuthController($class) : bool
290287
if ( $this->hasObject('parent', $class, __NAMESPACE__ . '\AbstractAuthController') ) {
291288
return true;
292289

293-
} elseif ( $this->hasAuthMiddlewareInterface($class) ) {
290+
} elseif ( $this->hasAuthMiddleInterface($class) ) {
294291
return true;
295292
}
296293
return false;
@@ -378,7 +375,7 @@ private function hasApiInterface($class) : bool
378375
* @param string $class
379376
* @return bool
380377
*/
381-
private function hasAuthMiddlewareInterface($class) : bool
378+
private function hasAuthMiddleInterface($class) : bool
382379
{
383380
return $this->hasObject('interface', $class, 'AuthMiddlewareInterface');
384381
}
@@ -412,7 +409,7 @@ private function parseModuleClass() : string
412409
$this->throwError(404);
413410
}
414411
$module = $this->removeString('Module', $class);
415-
return $this->getModuleNamespace() . "{$module}\\{$class}";
412+
return $this->getNamespace('module') . "{$module}\\{$class}";
416413
}
417414

418415
/**
@@ -428,7 +425,7 @@ private function parseClass() : string
428425
if ( !$class ) {
429426
$this->throwError(404);
430427
}
431-
return "{$this->getControllerNamespace()}{$class}";
428+
return "{$this->getNamespace('controller')}{$class}";
432429
}
433430

434431
/**
@@ -449,7 +446,7 @@ private function parseMethod() : string
449446
* @access private
450447
* @return mixed
451448
*/
452-
private function parsePermissions() : mixed
449+
private function parsePermission() : mixed
453450
{
454451
return $this->match['permissions'] ?? false;
455452
}

0 commit comments

Comments
 (0)