nnx-framework /
data-grid
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * @company MTE Telecom, Ltd. |
||
| 4 | * @author Roman Malashin <[email protected]> |
||
| 5 | */ |
||
| 6 | |||
| 7 | namespace Nnx\DataGrid; |
||
| 8 | |||
| 9 | use Nnx\DataGrid\Column\GridColumnProviderInterface; |
||
| 10 | use Nnx\DataGrid\Mutator\GridMutatorProviderInterface; |
||
| 11 | use \Nnx\DataGrid\Button\GridButtonProviderInterface; |
||
| 12 | use Nnx\DataGrid\Options\ModuleOptions; |
||
| 13 | use Zend\EventManager\EventInterface; |
||
| 14 | use Zend\ModuleManager\Feature\AutoloaderProviderInterface; |
||
| 15 | use Zend\ModuleManager\Feature\BootstrapListenerInterface; |
||
| 16 | use Zend\ModuleManager\Feature\ConfigProviderInterface; |
||
| 17 | use Zend\ModuleManager\Feature\InitProviderInterface; |
||
| 18 | use Zend\ModuleManager\Feature\ServiceProviderInterface; |
||
| 19 | use Zend\ModuleManager\Listener\ServiceListenerInterface; |
||
| 20 | use Zend\ModuleManager\ModuleManager; |
||
| 21 | use Zend\ModuleManager\ModuleManagerInterface; |
||
| 22 | use Zend\Mvc\MvcEvent; |
||
| 23 | use Zend\ServiceManager\ServiceLocatorAwareInterface; |
||
| 24 | use Zend\ServiceManager\ServiceLocatorAwareTrait; |
||
| 25 | use Zend\ServiceManager\ServiceLocatorInterface; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Class Module |
||
| 29 | * @package Nnx\DataGrid |
||
| 30 | */ |
||
| 31 | class Module |
||
| 32 | implements ServiceLocatorAwareInterface, |
||
| 33 | ConfigProviderInterface, |
||
| 34 | AutoloaderProviderInterface, |
||
| 35 | BootstrapListenerInterface, |
||
| 36 | ServiceProviderInterface, |
||
| 37 | InitProviderInterface |
||
| 38 | { |
||
| 39 | |||
| 40 | use ServiceLocatorAwareTrait; |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Имя секции в конфигах приложения, содержащей настройки модуля |
||
| 44 | * |
||
| 45 | * @var string |
||
| 46 | */ |
||
| 47 | const CONFIG_KEY = 'mteGrid'; |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Имя модуля |
||
| 51 | * |
||
| 52 | * @var string |
||
| 53 | */ |
||
| 54 | const MODULE_NAME = __NAMESPACE__; |
||
| 55 | |||
| 56 | /** |
||
| 57 | * Получаем конфигурацию модуля |
||
| 58 | * @return array |
||
| 59 | */ |
||
| 60 | public function getConfig() |
||
| 61 | { |
||
| 62 | return require __DIR__ . '/config/module.config.php'; |
||
| 63 | } |
||
| 64 | |||
| 65 | /** |
||
| 66 | * Return an array for passing to Zend\Loader\AutoloaderFactory. |
||
| 67 | * |
||
| 68 | * @return array |
||
| 69 | */ |
||
| 70 | public function getAutoloaderConfig() |
||
| 71 | { |
||
| 72 | $config = []; |
||
| 73 | $autoloadFile = __DIR__ . '/autoload_classmap.php'; |
||
| 74 | if (file_exists($autoloadFile)) { |
||
| 75 | $config['Zend\Loader\ClassMapAutoloader'] = [ |
||
| 76 | $autoloadFile |
||
| 77 | ]; |
||
| 78 | } |
||
| 79 | $config['Zend\Loader\StandardAutoloader'] = [ |
||
| 80 | 'namespaces' => [ |
||
| 81 | __NAMESPACE__ => __DIR__ . '/src' |
||
| 82 | ] |
||
| 83 | ]; |
||
| 84 | return $config; |
||
| 85 | } |
||
| 86 | |||
| 87 | /** |
||
| 88 | * Listen to the bootstrap event |
||
| 89 | * |
||
| 90 | * @param EventInterface $e |
||
| 91 | * @return array |
||
| 92 | */ |
||
| 93 | public function onBootstrap(EventInterface $e) |
||
|
0 ignored issues
–
show
|
|||
| 94 | { |
||
| 95 | /** @var MvcEvent $e */ |
||
| 96 | $this->setServiceLocator($e->getApplication()->getServiceManager()); |
||
| 97 | } |
||
| 98 | |||
| 99 | /** |
||
| 100 | * Expected to return \Zend\ServiceManager\Config object or array to |
||
| 101 | * seed such an object. |
||
| 102 | * |
||
| 103 | * @return array|\Zend\ServiceManager\Config |
||
| 104 | */ |
||
| 105 | public function getServiceConfig() |
||
| 106 | { |
||
| 107 | return []; |
||
| 108 | } |
||
| 109 | |||
| 110 | /** |
||
| 111 | * Initialize workflow |
||
| 112 | * |
||
| 113 | * @param ModuleManagerInterface $manager |
||
| 114 | * @throws Exception\RuntimeException |
||
| 115 | */ |
||
| 116 | public function init(ModuleManagerInterface $manager) |
||
| 117 | { |
||
| 118 | if (!$manager instanceof ModuleManager) { |
||
| 119 | $errMsg =sprintf('Менеджер модулей должен реализовывать %s', ModuleManager::class); |
||
| 120 | throw new Exception\RuntimeException($errMsg); |
||
| 121 | } |
||
| 122 | /** @var ModuleManager $manager */ |
||
| 123 | |||
| 124 | /** @var ServiceLocatorInterface $sm */ |
||
| 125 | $sm = $manager->getEvent()->getParam('ServiceManager'); |
||
|
0 ignored issues
–
show
|
|||
| 126 | |||
| 127 | /** @var ServiceListenerInterface $serviceListener */ |
||
| 128 | $serviceListener = $sm->get('ServiceListener'); |
||
| 129 | $serviceListener->addServiceManager( |
||
| 130 | 'GridManager', |
||
| 131 | 'grid_manager', |
||
| 132 | GridProviderInterface::class, |
||
| 133 | 'getGridConfig' |
||
| 134 | ); |
||
| 135 | |||
| 136 | $serviceListener->addServiceManager( |
||
| 137 | 'GridColumnManager', |
||
| 138 | 'grid_columns', |
||
| 139 | GridColumnProviderInterface::class, |
||
| 140 | 'getGridColumnConfig' |
||
| 141 | ); |
||
| 142 | $serviceListener->addServiceManager( |
||
| 143 | 'GridMutatorManager', |
||
| 144 | 'grid_mutators', |
||
| 145 | GridMutatorProviderInterface::class, |
||
| 146 | 'getGridMutatorConfig' |
||
| 147 | ); |
||
| 148 | $serviceListener->addServiceManager( |
||
| 149 | 'GridButtonManager', |
||
| 150 | 'grid_buttons', |
||
| 151 | GridButtonProviderInterface::class, |
||
| 152 | 'getGridButtonConfig' |
||
| 153 | ); |
||
| 154 | } |
||
| 155 | |||
| 156 | /** |
||
| 157 | * Возвращает объект с настройками модуля |
||
| 158 | * |
||
| 159 | * @return ModuleOptions |
||
| 160 | * @throws \Zend\ServiceManager\Exception\ServiceNotFoundException |
||
| 161 | */ |
||
| 162 | public function getModuleOptions() |
||
| 163 | { |
||
| 164 | /** @var ModuleOptions $moduleOptions */ |
||
| 165 | return $this->getServiceLocator()->get('GridModuleOptions'); |
||
| 166 | } |
||
| 167 | } |
||
| 168 |
Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.