1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of the Zemit Framework. |
4
|
|
|
* |
5
|
|
|
* (c) Zemit Team <[email protected]> |
6
|
|
|
* |
7
|
|
|
* For the full copyright and license information, please view the LICENSE.txt |
8
|
|
|
* file that was distributed with this source code. |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace Zemit\Provider\View; |
12
|
|
|
|
13
|
|
|
use Phalcon\Mvc\View; |
14
|
|
|
use Phalcon\Mvc\View\Simple; |
15
|
|
|
use InvalidArgumentException; |
16
|
|
|
use Phalcon\Mvc\View\Engine\Php; |
17
|
|
|
use Zemit\Listener\ViewListener; |
|
|
|
|
18
|
|
|
use Zemit\Mvc\View\Error as ViewError; |
19
|
|
|
use Zemit\Provider\AbstractServiceProvider; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Class ServiceProvider |
23
|
|
|
* |
24
|
|
|
* @author Julien Turbide <[email protected]> |
25
|
|
|
* @copyright Zemit Team <[email protected]> |
26
|
|
|
* |
27
|
|
|
* @since 1.0 |
28
|
|
|
* @version 1.0 |
29
|
|
|
* |
30
|
|
|
* @package Zemit\Provider\View |
31
|
|
|
*/ |
32
|
|
|
class ServiceProvider extends AbstractServiceProvider |
33
|
|
|
{ |
34
|
|
|
/** |
35
|
|
|
* The Service name. |
36
|
|
|
* @var string |
37
|
|
|
*/ |
38
|
|
|
protected $serviceName = 'view'; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* {@inheritdoc} |
42
|
|
|
* |
43
|
|
|
* @return void |
44
|
|
|
*/ |
45
|
4 |
|
public function register(\Phalcon\Di\DiInterface $di): void |
46
|
|
|
{ |
47
|
4 |
|
$di->setShared($this->getName(), function() use ($di) { |
|
|
|
|
48
|
|
|
$config = $di->get('config'); |
49
|
|
|
$eventsManager = $di->get('eventsManager'); |
50
|
|
|
|
51
|
|
|
$error = new ViewError(); |
52
|
|
|
$error->setDI($di); |
53
|
|
|
$eventsManager->attach('view', $error); |
54
|
|
|
|
55
|
|
|
$view = new \Zemit\Mvc\View(); |
56
|
|
|
$view->setMinify($config->app->minify); |
57
|
|
|
$view->registerEngines([ |
58
|
|
|
'.phtml' => 'Phalcon\Mvc\View\Engine\Php', |
59
|
|
|
'.volt' => 'Phalcon\Mvc\View\Engine\Volt', |
60
|
|
|
// '.mhtml' => 'Phalcon\Mvc\View\Engine\Mustache', |
61
|
|
|
// '.twig' => 'Phalcon\Mvc\View\Engine\Twig', // @TODO fix for non-existing viewdir |
62
|
|
|
// '.tpl' => 'Phalcon\Mvc\View\Engine\Smarty' |
63
|
|
|
]); |
64
|
|
|
|
65
|
|
|
$view->setEventsManager($eventsManager); |
66
|
|
|
$view->setDI($di); |
67
|
|
|
|
68
|
|
|
return $view; |
69
|
|
|
}); |
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
|
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