Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
12 / 12 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
AppTemplateFactory | |
100.00% |
12 / 12 |
|
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
createTemplate | |
100.00% |
12 / 12 |
|
100.00% |
1 / 1 |
2 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace PeServer\App\Models; |
6 | |
7 | use PeServer\App\Models\AppTemplateOptions; |
8 | use PeServer\Core\DI\DiFactoryBase; |
9 | use PeServer\Core\DI\DiFactoryTrait; |
10 | use PeServer\Core\DI\IDiContainer; |
11 | use PeServer\Core\IO\Directory; |
12 | use PeServer\Core\IO\Path; |
13 | use PeServer\Core\Mvc\Template\ITemplateFactory; |
14 | use PeServer\Core\Mvc\Template\SmartyTemplate; |
15 | use PeServer\Core\Mvc\Template\TemplateBase; |
16 | use PeServer\Core\Mvc\Template\TemplateFactory; |
17 | use PeServer\Core\Mvc\Template\TemplateOptions; |
18 | use PeServer\Core\Throws\NotImplementedException; |
19 | |
20 | class AppTemplateFactory extends TemplateFactory |
21 | { |
22 | use DiFactoryTrait; |
23 | |
24 | #region TemplateFactory |
25 | |
26 | /** |
27 | * @param TemplateOptions $options めっちゃかえるで。 |
28 | */ |
29 | public function createTemplate(TemplateOptions $options): TemplateBase |
30 | { |
31 | $customOptions = $options; |
32 | if ($options instanceof AppTemplateOptions) { |
33 | /** @var AppConfiguration */ |
34 | $config = $this->container->get(AppConfiguration::class); |
35 | |
36 | $customOptions = new TemplateOptions( |
37 | Path::combine($options->programContext->applicationDirectory, 'App', 'Views'), |
38 | $options->controllerName, |
39 | $options->programContext, |
40 | $options->urlHelper, |
41 | $options->webSecurity, |
42 | $config->setting->cache->template |
43 | ); |
44 | } |
45 | |
46 | return parent::createTemplate($customOptions); |
47 | } |
48 | |
49 | #endregion |
50 | } |