1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Ffcms\Core\Arch; |
4
|
|
|
|
5
|
|
|
use Ffcms\Core\App; |
6
|
|
|
use Ffcms\Core\Helper\FileSystem\Directory; |
7
|
|
|
use Ffcms\Core\Helper\Type\Str; |
8
|
|
|
use Ffcms\Templex\Engine; |
|
|
|
|
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Class View. Classic realisation of view's management in MVC architecture. |
12
|
|
|
* This class can be uses as object - (new View())->render() or from entry point App::$View->render() or |
13
|
|
|
* from controller action like $this->view->render() |
14
|
|
|
* @package Ffcms\Core\Arch |
15
|
|
|
* @property string $title |
16
|
|
|
* @property string $description |
17
|
|
|
* @property string $keywords |
18
|
|
|
* @property array $breadcrumbs |
19
|
|
|
*/ |
20
|
|
|
class View extends Engine |
21
|
|
|
{ |
22
|
|
|
public $lang = 'en'; |
23
|
|
|
|
24
|
|
|
private $path; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* View constructor. Initialize template engine |
28
|
|
|
*/ |
29
|
|
|
public function __construct() |
30
|
|
|
{ |
31
|
|
|
$this->lang = App::$Request->getLanguage(); |
32
|
|
|
// get theme from config based on env_name global |
33
|
|
|
$theme = App::$Properties->get('theme')[env_name] ?? 'default'; |
|
|
|
|
34
|
|
|
$env = ucfirst(Str::lowerCase(env_name)); |
35
|
|
|
|
36
|
|
|
$this->path = root . DIRECTORY_SEPARATOR . 'Apps' . DIRECTORY_SEPARATOR . 'View' . DIRECTORY_SEPARATOR . $env . DIRECTORY_SEPARATOR . $theme; |
|
|
|
|
37
|
|
|
if (!Directory::exist($this->path)) { |
38
|
|
|
if (App::$Debug) { |
39
|
|
|
App::$Debug->addMessage('Template root directory is not exist: ' . $this->path, 'error'); |
40
|
|
|
} |
41
|
|
|
return; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
// initialize template engine with path and load default extensions |
45
|
|
|
parent::__construct($this->path); |
46
|
|
|
$this->loadDefaultExtensions(); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Get current template absolute path |
51
|
|
|
* @return string|null |
52
|
|
|
*/ |
53
|
|
|
public function getCurrentPath(): ?string |
54
|
|
|
{ |
55
|
|
|
return $this->path; |
56
|
|
|
} |
57
|
|
|
} |
58
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths