5 Commits
1.0 ... 1.2

Author SHA1 Message Date
User
d43d4751a7 20230818#2 2023-08-18 01:48:17 +03:00
User
c681f88de4 20230818#1 2023-08-18 01:42:24 +03:00
User
d5a9d0fc10 20230626#3 2023-06-26 20:29:49 +03:00
User
407529f092 20230626#2 2023-06-26 20:13:30 +03:00
User
1f902c6b70 20230626#1 2023-06-26 19:58:04 +03:00
2 changed files with 5 additions and 18 deletions

View File

@@ -12,10 +12,3 @@ composer require rmphp/kernel
```bash ```bash
composer require rmphp/kernel:"^1.0" composer require rmphp/kernel:"^1.0"
``` ```
Dev version contains the latest changes
```bash
composer require rmphp/kernel:"1.0.x-dev"
```

View File

@@ -34,6 +34,8 @@ class App extends Main {
public function handler(ServerRequestInterface $request, ResponseInterface $response) : ResponseInterface { public function handler(ServerRequestInterface $request, ResponseInterface $response) : ResponseInterface {
try{ try{
$this->init($request, $response); $this->init($request, $response);
$this->syslogger()->dump("Request", $request);
$this->syslogger()->dump("Router", $this->router);
$this->syslogger()->dump("routes", $this->appRoutes); $this->syslogger()->dump("routes", $this->appRoutes);
foreach ($this->appRoutes as $appRouteKey => $appHandler){ foreach ($this->appRoutes as $appRouteKey => $appHandler){
@@ -47,7 +49,7 @@ class App extends Main {
continue; continue;
} }
$controllers[$appRouteKey] = new $appHandler->className; $controllers[$appRouteKey] = new $appHandler->className;
$log = "OK - Class ".$appHandler->className; $log = "Class ".$appHandler->className;
if(!empty($appHandler->methodName)){ if(!empty($appHandler->methodName)){
if(!method_exists($appHandler->className, $appHandler->methodName)) { if(!method_exists($appHandler->className, $appHandler->methodName)) {
@@ -55,9 +57,9 @@ class App extends Main {
continue; continue;
} }
$response = (!empty($appHandler->params)) ? $controllers[$appRouteKey]->{$appHandler->methodName}(...$appHandler->params) : $controllers[$appRouteKey]->{$appHandler->methodName}(); $response = (!empty($appHandler->params)) ? $controllers[$appRouteKey]->{$appHandler->methodName}(...$appHandler->params) : $controllers[$appRouteKey]->{$appHandler->methodName}();
$log = "OK - Method ".$appHandler->className."/".$appHandler->methodName; $log = "Method ".$appHandler->className."/".$appHandler->methodName;
} }
$this->syslogger()->log("handlers", $log); $this->syslogger()->log("handlers", "OK - ".$log);
/** /**
* 1. Если на этапе итерации уже получен ответ ResponseInterface - досрочно отдаем результат в эмиттер * 1. Если на этапе итерации уже получен ответ ResponseInterface - досрочно отдаем результат в эмиттер
*/ */
@@ -155,11 +157,6 @@ class App extends Main {
if(is_file($this->baseDir."/".getenv("APP_NODES_FILE"))){ if(is_file($this->baseDir."/".getenv("APP_NODES_FILE"))){
$nodes = include_once $this->baseDir."/".getenv("APP_NODES_FILE"); $nodes = include_once $this->baseDir."/".getenv("APP_NODES_FILE");
} }
for ($appNodeNum = 1; getenv("APP_NODE".$appNodeNum); $appNodeNum++){
$nodesCollection[] = json_decode(getenv("APP_NODE".$appNodeNum), true);
}
if(isset($nodesCollection)) $nodes = $nodesCollection;
if(empty($nodes) || !is_array($nodes)) throw AppException::emptyAppNodes(); if(empty($nodes) || !is_array($nodes)) throw AppException::emptyAppNodes();
$this->getActions($nodes); $this->getActions($nodes);
} }
@@ -190,9 +187,6 @@ class App extends Main {
if(pathinfo($this->baseDir."/".$appNode['router'])['extension'] == "php") { if(pathinfo($this->baseDir."/".$appNode['router'])['extension'] == "php") {
$this->router->withRules(include_once $this->baseDir."/".$appNode['router']); $this->router->withRules(include_once $this->baseDir."/".$appNode['router']);
} }
elseif(pathinfo($this->baseDir."/".$appNode['router'])['extension'] == "json") {
$this->router->withRules(json_decode(file_get_contents($this->baseDir."/".$appNode['router']), true));
}
elseif(pathinfo($this->baseDir."/".$appNode['router'])['extension'] == "yaml") { elseif(pathinfo($this->baseDir."/".$appNode['router'])['extension'] == "yaml") {
$this->router->withRules(yaml_parse_file($this->baseDir."/".$appNode['router'])); $this->router->withRules(yaml_parse_file($this->baseDir."/".$appNode['router']));
} }