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


PHP Enlight_Event_EventArgs::getName方法代码示例

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


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

示例1: onGetCustomSortControllerPath

 /**
  * This function is responsible to resolve the backend / frontend controller path.
  *
  * @param  \Enlight_Event_EventArgs $args
  * @return string
  */
 public function onGetCustomSortControllerPath(\Enlight_Event_EventArgs $args)
 {
     $this->templateManager->addTemplateDir($this->bootstrapPath . 'Views/');
     switch ($args->getName()) {
         case 'Enlight_Controller_Dispatcher_ControllerPath_Backend_CustomSort':
             return $this->bootstrapPath . 'Controllers/Backend/CustomSort.php';
         case 'Enlight_Controller_Dispatcher_ControllerPath_Widgets_CustomSort':
             return $this->bootstrapPath . 'Controllers/Widgets/CustomSort.php';
     }
 }
开发者ID:zirkeldesign,项目名称:SwagCustomSort,代码行数:16,代码来源:ControllerPath.php

示例2: load

 /**
  * Generic callback function for all registered subscribers in this class. Will dispatch the event to
  * the anonymous function of the corresponding service
  *
  * @param \Enlight_Event_EventArgs $args
  * @return mixed
  */
 public function load(\Enlight_Event_EventArgs $args)
 {
     // get registered service from event name
     $name = str_replace('Enlight_Bootstrap_InitResource_', '', $args->getName());
     // call anonymous function in order to register service
     $method = self::$definitions[$name];
     if (!$method) {
         throw new \RuntimeException("Service named {$name} not found");
     }
     return $method(self::$container, $args);
 }
开发者ID:dnoegel,项目名称:lazy-subscriber,代码行数:18,代码来源:LazySubscriber.php

示例3: onBenchmarkEvent

 /**
  * @param \Enlight_Event_EventArgs $args
  * @return mixed
  */
 public function onBenchmarkEvent(\Enlight_Event_EventArgs $args)
 {
     $event = $args->getName();
     if (!isset($this->results[$event])) {
         $this->results[$event] = array(0 => true, 1 => 0, 2 => 0, 3 => microtime(true));
     }
     if (empty($this->results[$event][0])) {
         $this->results[$event][0] = true;
         $this->results[$event][1] -= memory_get_peak_usage(true);
         $this->results[$event][2] -= microtime(true);
     } else {
         $this->results[$event][0] = false;
         $this->results[$event][1] += memory_get_peak_usage(true);
         $this->results[$event][2] += microtime(true);
     }
     return $args->getReturn();
 }
开发者ID:wesolowski,项目名称:shopware-clockwork,代码行数:21,代码来源:EventCollector.php

示例4: onBenchmarkEvent

    /**
     * Logs all controller events into the internal log object.
     * Each logged events contains the event name, the execution time and the allocated peak of memory.
     *
     * @param Enlight_Event_EventArgs $args
     * @return void
     */
    public function onBenchmarkEvent(Enlight_Event_EventArgs $args)
    {
        if (empty($this->results)) {
            $this->results[] = array('name', 'memory', 'time');
            $this->startTime = microtime(true);
            $this->startMemory = memory_get_peak_usage(true);
        }

        $this->results[] = array(
            0 => str_replace('Enlight_Controller_', '', $args->getName()),
            1 => $this->formatMemory(memory_get_peak_usage(true) - $this->startMemory),
            2 => $this->formatTime(microtime(true) - $this->startTime)
        );
    }
开发者ID:nhp,项目名称:shopware-4,代码行数:21,代码来源:Bootstrap.php

示例5: onEvent

 /**
  * Internal listener function of each fired event in shopware.
  *
  * @param Enlight_Event_EventArgs $args
  * @return mixed
  */
 public function onEvent(Enlight_Event_EventArgs $args)
 {
     if ($this->preventEventLog) {
         return $args->getReturn();
     }
     $event = $args->getName();
     $this->events[$event]['returns'][] = $args->getReturn();
     $this->events[$event]['time'][] = microtime(true);
     return $args->getReturn();
 }
开发者ID:shopwareLabs,项目名称:SwagProfiling,代码行数:16,代码来源:Bootstrap.php

示例6: getDefaultControllerPath

 /**
  * Standard event listener function for plugin controllers.
  * If the default event listener is used for the registration of a plugin controller, the following requirements must be fulfilled:
  *  1. The plugin directory must contain a 'Controller' subdirectory.
  *  2. The "Controllers" directory must contain a subdirectory which corresponds to the module (Frontend, Backend, Widgets or API)
  *  3. The controller must be filed in the module directory.
  *  4. The controller file must have the same name as the controller class.
  *
  * If all the requirements are fulfilled, the controller is registered automatically.
  * Additionally, the following plugin namespaces/directories are registered, if available:
  *  1. The 'Views' plugin directory is added as a template directory.
  *  2. The 'Snippets' plugin directory is added as a config directory.
  *  3. The 'Components' plugin directory is added as a component namespace.
  *
  * @param Enlight_Event_EventArgs $arguments
  * @throws Exception
  * @return string
  */
 public function getDefaultControllerPath(Enlight_Event_EventArgs $arguments)
 {
     $eventName = $arguments->getName();
     $eventName = str_replace('Enlight_Controller_Dispatcher_ControllerPath_', '', $eventName);
     $parts = explode('_', $eventName);
     $module = $parts[0];
     $controller = $parts[1];
     $path = $this->Path() . 'Controllers/' . ucfirst($module) . '/' . ucfirst($controller) . '.php';
     if (!file_exists($path)) {
         throw new Enlight_Exception('Controller "' . $controller . '" can\'t load failure');
     }
     //register plugin model directory
     if (file_exists($this->Path() . 'Models')) {
         $this->registerCustomModels();
     }
     //register plugin views directory
     if (file_exists($this->Path() . 'Views')) {
         $this->Application()->Template()->addTemplateDir($this->Path() . 'Views/');
     }
     //register plugin snippet directory
     if (file_exists($this->Path() . 'Snippets')) {
         $this->Application()->Snippets()->addConfigDir($this->Path() . 'Snippets/');
     }
     //register plugin component directory
     if (file_exists($this->Path() . 'Components')) {
         $this->Application()->Loader()->registerNamespace('Shopware_Components', $this->Path() . 'Components/');
     }
     return $path;
 }
开发者ID:ClaudioThomas,项目名称:shopware-4,代码行数:47,代码来源:Bootstrap.php


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