当前位置: 首页>>代码示例>>PHP>>正文


PHP ModuleEvent::getModuleName方法代码示例

本文整理汇总了PHP中Zend\ModuleManager\ModuleEvent::getModuleName方法的典型用法代码示例。如果您正苦于以下问题:PHP ModuleEvent::getModuleName方法的具体用法?PHP ModuleEvent::getModuleName怎么用?PHP ModuleEvent::getModuleName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\ModuleManager\ModuleEvent的用法示例。


在下文中一共展示了ModuleEvent::getModuleName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __invoke

 /**
  * @param \Zend\ModuleManager\ModuleEvent $e
  *
  * @throws Exception\MissingDependencyModuleException
  */
 public function __invoke(ModuleEvent $e)
 {
     $module = $e->getModule();
     if ($module instanceof DependencyIndicatorInterface || method_exists($module, 'getModuleDependencies')) {
         $dependencies = $module->getModuleDependencies();
         foreach ($dependencies as $dependencyModule) {
             if (!isset($this->loaded[$dependencyModule])) {
                 throw new Exception\MissingDependencyModuleException(sprintf('Module "%s" depends on module "%s", which was not initialized before it', $e->getModuleName(), $dependencyModule));
             }
         }
     }
     $this->loaded[$e->getModuleName()] = true;
 }
开发者ID:eltondias,项目名称:Relogio,代码行数:18,代码来源:ModuleDependencyCheckerListener.php

示例2: __invoke

 /**
  * @param  ModuleEvent $e
  * @return object|false False if module class does not exist
  */
 public function __invoke(ModuleEvent $e)
 {
     $moduleName = $e->getModuleName();
     $class = $moduleName . '\\Module';
     if (!class_exists($class)) {
         return false;
     }
     return new $class();
 }
开发者ID:karnurik,项目名称:zf2-turtorial,代码行数:13,代码来源:ModuleResolverListener.php

示例3: __invoke

 /**
  * @param  ModuleEvent $e
  * @return object|false False if module class does not exist
  */
 public function __invoke(ModuleEvent $e)
 {
     $moduleName = $e->getModuleName();
     $class = $moduleName . '\\Module';
     if (!class_exists($class)) {
         // If expected module class was not found, check for the possible class name variations:
         // - If module directory uses ZF1 naming style (spinal-case instead of CamelCase), check
         //   for Module class in Camel-Cased module name namespace
         // - If that fails, check for class name prefixed with Camel-Cased module name
         //   (no autoloading involved here)
         $moduleName = $this->formatModuleName($moduleName);
         $class = $moduleName . '\\Module';
         if (!class_exists($class)) {
             $class = $moduleName . '_Module';
             if (!class_exists($class, false)) {
                 return false;
             }
         }
     }
     $module = new $class();
     return $module;
 }
开发者ID:xemlock,项目名称:HumusMvc,代码行数:26,代码来源:ModuleResolverListener.php

示例4: onLoadModule

 public function onLoadModule(ModuleEvent $e)
 {
     $module = $e->getModule();
     if (!$module instanceof DirectoryProviderInterface && !method_exists($module, 'getDir')) {
         return;
     }
     $moduleDirectory = $module->getDir();
     if (!is_dir($moduleDirectory)) {
         return;
     }
     // Store the module path
     $moduleName = $e->getModuleName();
     $this->paths[$moduleName] = array('path' => $moduleDirectory, 'template_path_stack' => null, 'default_template_path_stack' => null);
     // Check for especific module-dependant themes
     if ($module instanceof ConfigProviderInterface || is_callable(array($this, 'getConfig'))) {
         $config = $module->getConfig();
         if ($config instanceof Traversable) {
             $config = ArrayUtils::iteratorToArray($config);
         }
         if (!is_array($config)) {
             throw new Exception\InvalidArgumentException(sprintf('Config being merged must be an array, ' . 'implement the Traversable interface, or be an ' . 'instance of Zend\\Config\\Config. %s given.', gettype($config)));
         }
         if (isset($config['theme_manager'])) {
             if (is_array($config['theme_manager'])) {
                 if (isset($config['theme_manager']['template_path_stack'])) {
                     $this->paths[$moduleName]['template_path_stack'] = $config['theme_manager']['template_path_stack'];
                 }
             }
         }
         if (isset($config['view_manager'])) {
             if (is_array($config['view_manager'])) {
                 if (isset($config['view_manager']['template_path_stack'])) {
                     $this->paths[$moduleName]['default_template_path_stack'] = $config['view_manager']['template_path_stack'];
                 }
             }
         }
     }
 }
开发者ID:shadowfax,项目名称:zf2-theme-manager,代码行数:38,代码来源:ThemeListener.php

示例5: onLoadModule

 /**
  * Merge the config for each module
  *
  * @param  ModuleEvent $e
  * @return ConfigListener
  */
 public function onLoadModule(ModuleEvent $e)
 {
     $module = $e->getModule();
     if (!$module instanceof ConfigProviderInterface && !is_callable(array($module, 'getConfig'))) {
         return $this;
     }
     $config = $module->getConfig();
     $this->addConfig($e->getModuleName(), $config);
     return $this;
 }
开发者ID:totolouis,项目名称:ZF2-Auth,代码行数:16,代码来源:ConfigListener.php

示例6: onLoadModule

 /**
  * Retrieve service manager configuration from module, and
  * configure the service manager.
  *
  * If the module does not implement a specific interface and does not
  * implement a specific method, does nothing. Also, if the return value
  * of that method is not a ServiceConfig object, or not an array or
  * Traversable that can seed one, does nothing.
  *
  * The interface and method name can be set by adding a new service manager
  * via the addServiceManager() method.
  *
  * @param  ModuleEvent $e
  * @return void
  */
 public function onLoadModule(ModuleEvent $e)
 {
     $module = $e->getModule();
     foreach ($this->serviceManagers as $key => $sm) {
         if (!$module instanceof $sm['module_class_interface'] && !method_exists($module, $sm['module_class_method'])) {
             continue;
         }
         $config = $module->{$sm['module_class_method']}();
         if ($config instanceof ServiceConfigInterface) {
             $config = $this->serviceConfigToArray($config);
         }
         if ($config instanceof Traversable) {
             $config = ArrayUtils::iteratorToArray($config);
         }
         if (!is_array($config)) {
             // If we do not have an array by this point, nothing left to do.
             continue;
         }
         // We are keeping track of which modules provided which configuration to which service managers.
         // The actual merging takes place later. Doing it this way will enable us to provide more powerful
         // debugging tools for showing which modules overrode what.
         $fullname = $e->getModuleName() . '::' . $sm['module_class_method'] . '()';
         $this->serviceManagers[$key]['configuration'][$fullname] = $config;
     }
 }
开发者ID:zendframework,项目名称:zend-modulemanager,代码行数:40,代码来源:ServiceListener.php

示例7: getServicesTrigger

 /**
  * Event callback for 'initServicesTrigger'.
  *
  * @param ModuleEvent $e
  *
  * @return $this
  */
 public function getServicesTrigger(ModuleEvent $e)
 {
     $module = $e->getModule();
     if (is_callable(array($module, 'getServiceConfig'))) {
         $services = $module->getServiceConfig();
         if (is_array($services) && isset($services['factories'])) {
             $this->services[$e->getModuleName()] = $services['factories'];
         }
     }
     return $this;
 }
开发者ID:BeastModeON,项目名称:framework,代码行数:18,代码来源:DefaultListenerAggregate.php


注:本文中的Zend\ModuleManager\ModuleEvent::getModuleName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。