bluzphp /
skeleton
| 1 | <?php |
||||||
| 2 | /** |
||||||
| 3 | * @author Anton Shevchuk |
||||||
| 4 | * @created 10.10.11 16:48 |
||||||
| 5 | */ |
||||||
| 6 | |||||||
| 7 | /** |
||||||
| 8 | * @namespace |
||||||
| 9 | */ |
||||||
| 10 | |||||||
| 11 | namespace Application; |
||||||
| 12 | |||||||
| 13 | use Bluz\Common\Exception\CommonException; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 14 | use Bluz\Common\Exception\ComponentException; |
||||||
|
0 ignored issues
–
show
The type
Bluz\Common\Exception\ComponentException was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 15 | use Bluz\Controller\Controller; |
||||||
|
0 ignored issues
–
show
The type
Bluz\Controller\Controller was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 16 | use Bluz\Controller\ControllerException; |
||||||
|
0 ignored issues
–
show
The type
Bluz\Controller\ControllerException was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 17 | use Bluz\Proxy\Layout; |
||||||
| 18 | use ReflectionException; |
||||||
| 19 | |||||||
| 20 | /** |
||||||
| 21 | * @privilege View |
||||||
| 22 | * |
||||||
| 23 | * @return void |
||||||
| 24 | 1 | * @throws CommonException |
|||||
| 25 | 1 | * @throws ComponentException |
|||||
| 26 | * @throws ControllerException |
||||||
| 27 | 1 | * @throws ReflectionException |
|||||
| 28 | 1 | */ |
|||||
| 29 | return function () { |
||||||
| 30 | /** |
||||||
| 31 | * @var Controller $this |
||||||
| 32 | 1 | */ |
|||||
| 33 | 1 | Layout::setTemplate('dashboard.phtml'); |
|||||
| 34 | 1 | Layout::breadCrumbs( |
|||||
| 35 | 1 | [ |
|||||
| 36 | Layout::ahref('Dashboard', ['dashboard', 'index']), |
||||||
| 37 | 1 | __('Permissions') |
|||||
|
0 ignored issues
–
show
The function
__ 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
Loading history...
|
|||||||
| 38 | 1 | ] |
|||||
| 39 | 1 | ); |
|||||
| 40 | |||||||
| 41 | 1 | $set = []; |
|||||
| 42 | $path = PATH_APPLICATION . '/modules'; |
||||||
| 43 | $directoryIterator = new \DirectoryIterator($path); |
||||||
| 44 | 1 | $modules = []; |
|||||
| 45 | |||||||
| 46 | 1 | foreach ($directoryIterator as $directory) { |
|||||
| 47 | 1 | if ($directory->isDot() || !$directory->isDir()) { |
|||||
| 48 | 1 | continue; |
|||||
| 49 | } |
||||||
| 50 | 1 | $modules[] = $directory->getBasename(); |
|||||
| 51 | } |
||||||
| 52 | |||||||
| 53 | 1 | sort($modules); |
|||||
| 54 | 1 | ||||||
| 55 | 1 | foreach ($modules as $module) { |
|||||
| 56 | $controllerPath = $path . '/' . $module . '/controllers/'; |
||||||
| 57 | $controllerPathLength = strlen($controllerPath); |
||||||
| 58 | 1 | ||||||
| 59 | if (!is_dir($controllerPath)) { |
||||||
| 60 | continue; |
||||||
| 61 | } |
||||||
| 62 | 1 | $filesIterator = new \RecursiveIteratorIterator( |
|||||
| 63 | 1 | new \RecursiveDirectoryIterator( |
|||||
| 64 | $controllerPath, |
||||||
| 65 | \FilesystemIterator::KEY_AS_PATHNAME |
||||||
| 66 | 1 | | \FilesystemIterator::CURRENT_AS_FILEINFO |
|||||
| 67 | | \FilesystemIterator::SKIP_DOTS |
||||||
| 68 | 1 | ) |
|||||
| 69 | ); |
||||||
| 70 | |||||||
| 71 | 1 | if (!isset($set[$module])) { |
|||||
| 72 | 1 | $set[$module] = []; |
|||||
| 73 | 1 | } |
|||||
| 74 | |||||||
| 75 | 1 | foreach ($filesIterator as $filePath => $fileInfo) { |
|||||
| 76 | 1 | /* @var \SplFileInfo $fileInfo */ |
|||||
| 77 | if ($fileInfo->getExtension() !== 'php') { |
||||||
| 78 | continue; |
||||||
| 79 | 1 | } |
|||||
| 80 | 1 | $controller = $fileInfo->getBasename('.php'); |
|||||
| 81 | if ($prefix = substr($fileInfo->getPath(), $controllerPathLength)) { |
||||||
| 82 | $controller = $prefix . '/' . $controller; |
||||||
| 83 | 1 | } |
|||||
| 84 | $controllerInstance = new Controller($module, $controller); |
||||||
| 85 | $meta = $controllerInstance->getMeta(); |
||||||
| 86 | |||||||
| 87 | |||||||
| 88 | 1 | if (($privilege = $meta->getPrivilege()) && !in_array($privilege, $set[$module], true)) { |
|||||
| 89 | $set[$module][] = $privilege; |
||||||
| 90 | 1 | } |
|||||
| 91 | |||||||
| 92 | 1 | if ($acl = $meta->getAcl()) { |
|||||
| 93 | 1 | array_push($set[$module], ...$acl); |
|||||
| 94 | } |
||||||
| 95 | 1 | } |
|||||
| 96 | 1 | ||||||
| 97 | $set[$module] = array_unique($set[$module]); |
||||||
| 98 | } |
||||||
| 99 | 1 | $this->assign('set', $set); |
|||||
| 100 | 1 | ||||||
| 101 | 40 | $privilegesRowset = Privileges\Table::getInstance()->getPrivileges(); |
|||||
| 102 | $privileges = []; |
||||||
| 103 | |||||||
| 104 | foreach ($privilegesRowset as $privilege) { |
||||||
| 105 | array_add($privileges, $privilege->roleId, $privilege->module, $privilege->privilege); |
||||||
|
0 ignored issues
–
show
The function
array_add 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
Loading history...
|
|||||||
| 106 | } |
||||||
| 107 | |||||||
| 108 | $this->assign('privileges', $privileges); |
||||||
| 109 | $this->assign('roles', Roles\Table::getInstance()->getRoles()); |
||||||
| 110 | }; |
||||||
| 111 |
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