Skip to content

Commit 39db9c7

Browse files
committed
Merge branch 'develop'
2 parents d5b0417 + 59eb313 commit 39db9c7

File tree

5 files changed

+25
-34
lines changed

5 files changed

+25
-34
lines changed

Http/BaseController.php

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,25 @@
99
use Psr\Http\Message\ServerRequestInterface;
1010
use Qubus\Routing\Controller\Controller;
1111
use Qubus\Routing\Router;
12+
use Qubus\View\Native\NativeLoader;
1213
use Qubus\View\Renderer;
1314

1415
use function Codefy\Framework\Helpers\app;
16+
use function Codefy\Framework\Helpers\config;
1517

1618
class BaseController extends Controller implements RoutingController
1719
{
18-
protected ServerRequestInterface $request;
19-
protected ResponseInterface $response;
20-
protected Router $router;
21-
protected Renderer $view;
22-
2320
public function __construct(
24-
?ServerRequestInterface $request = null,
25-
?ResponseInterface $response = null,
26-
?Router $router = null,
27-
?Renderer $view = null
21+
protected ?ServerRequestInterface $request = null,
22+
protected ?ResponseInterface $response = null,
23+
protected ?Router $router = null,
24+
protected ?Renderer $view = null,
25+
2826
) {
2927
$this->setRequest($request ?? app(name: ServerRequestInterface::class));
3028
$this->response = $response ?? app(name: ResponseInterface::class);
3129
$this->router = $router ?? app(name: 'router');
32-
$this->setView($view ?? app(name: 'view'));
30+
$this->setView($view ?? new NativeLoader(config('view.path')));
3331
}
3432

3533
/**

Scheduler/BaseTask.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ abstract class BaseTask extends BaseProcessor implements Task
3030

3131
protected TaskId $pid;
3232

33-
protected array $options;
33+
protected array $options = [];
3434

35-
protected bool $truthy;
35+
protected bool $truthy = false;
3636

3737
protected string|null $timeZone = null;
3838

View/FenomView.php

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,28 @@
77
use Fenom;
88
use Fenom\Error\CompileException;
99
use Fenom\Provider;
10-
use Qubus\Config\ConfigContainer;
11-
use Qubus\Exception\Exception;
1210
use Qubus\View\Renderer;
1311

12+
use function Codefy\Framework\Helpers\config;
13+
1414
final class FenomView implements Renderer
1515
{
16-
private Fenom $view;
16+
private Fenom $fenom;
1717

18-
/**
19-
* @throws Exception
20-
*/
21-
public function __construct(ConfigContainer $config)
18+
public function __construct()
2219
{
23-
$this->view = (new Fenom(
24-
provider: new Provider(template_dir: $config->getConfigKey('view.path'))
20+
$this->fenom = (new Fenom(
21+
provider: new Provider(template_dir: config(key: 'view.path'))
2522
))->setCompileDir(
26-
dir: $config->getConfigKey('view.cache')
27-
)->setOptions(options: $config->getConfigKey('view.options'));
23+
dir: config(key: 'view.cache')
24+
)->setOptions(options: config(key: 'view.options'));
2825
}
2926

3027
/**
3128
* @throws CompileException
3229
*/
3330
public function render(array|string $template, array $data = []): string|array
3431
{
35-
return $this->view->display(template: $template, vars: $data);
32+
return $this->fenom->display(template: $template, vars: $data);
3633
}
3734
}

View/FoilView.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,22 @@
55
namespace Codefy\Framework\View;
66

77
use Foil\Engine;
8-
use Qubus\Config\ConfigContainer;
9-
use Qubus\Exception\Exception;
108
use Qubus\View\Renderer;
119

10+
use function Codefy\Framework\Helpers\config;
1211
use function Foil\engine;
1312

1413
final class FoilView implements Renderer
1514
{
16-
private Engine $view;
15+
private Engine $engine;
1716

18-
/**
19-
* @throws Exception
20-
*/
21-
public function __construct(ConfigContainer $config)
17+
public function __construct()
2218
{
23-
$this->view = engine($config->getConfigKey('view.options'));
19+
$this->engine = engine(config(key: 'view.options'));
2420
}
2521

2622
public function render(array|string $template, array $data = []): string|array
2723
{
28-
return $this->view->render(template: $template, data: $data);
24+
return $this->engine->render(template: $template, data: $data);
2925
}
3026
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "codefyphp/codefy",
33
"type": "library",
4-
"description": "CodefyPHP Framework.",
4+
"description": "PHP framework for Domain Driven Development, CQRS, and Event Sourcing.",
55
"keywords": ["codefy","codefyphp","codefy-php","routing","application","container","framework","php-framework"],
66
"license": "MIT",
77
"authors": [

0 commit comments

Comments
 (0)