1 | <?php |
||||
2 | |||||
3 | namespace Nip\View\Traits; |
||||
4 | |||||
5 | use Nip\Mvc\Modules; |
||||
0 ignored issues
–
show
|
|||||
6 | use ReflectionClass; |
||||
7 | |||||
8 | /** |
||||
9 | * Class ModuleView |
||||
10 | * @package Nip\View |
||||
11 | */ |
||||
12 | trait ModuleView |
||||
13 | { |
||||
14 | |||||
15 | /** |
||||
16 | * @return string |
||||
17 | */ |
||||
18 | protected function generateBasePath() |
||||
19 | { |
||||
20 | $folderPath = $this->generateFolderBasePath(); |
||||
21 | if (is_dir($folderPath)) { |
||||
22 | return $folderPath; |
||||
23 | } |
||||
24 | |||||
25 | return $this->generateModuleBasePath(); |
||||
26 | } |
||||
27 | |||||
28 | /** |
||||
29 | * @return string |
||||
30 | */ |
||||
31 | public function generateModuleBasePath() |
||||
32 | { |
||||
33 | /** @var Modules $modules */ |
||||
34 | $modules = app('mvc.modules'); |
||||
0 ignored issues
–
show
The function
app was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
35 | |||||
36 | return $modules->getViewPath($this->getModuleName()); |
||||
37 | } |
||||
38 | |||||
39 | /** |
||||
40 | * @return string |
||||
41 | */ |
||||
42 | public function generateFolderBasePath() |
||||
43 | { |
||||
44 | $reflector = new ReflectionClass(get_class($this)); |
||||
45 | $dirName = dirname($reflector->getFileName()); |
||||
46 | |||||
47 | return dirname(dirname($dirName)).DIRECTORY_SEPARATOR."views".DIRECTORY_SEPARATOR; |
||||
48 | } |
||||
49 | |||||
50 | /** |
||||
51 | * @return string |
||||
52 | */ |
||||
53 | public function getModuleName() |
||||
54 | { |
||||
55 | return 'default'; |
||||
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