/** * Load a helper * * Injects the view object into the helper prior to returning it. * * @param mixed $plugin * @param array $options * @return void */ public function load($plugin, array $options = null) { $helper = parent::load($plugin, $options); if (null !== ($view = $this->getView())) { $helper->setView($view); } return $helper; }
/** * Get plugin class that handles this resource * * @param resource $resource Resource type * @return object Resource class */ public static function getResourceParser($resource) { if (self::$_resourceBroker) { $type = preg_replace("/[^A-Za-z0-9_]/", " ", get_resource_type($resource)); $type = str_replace(" ", "", ucwords($type)); return self::$_resourceBroker->load($type); } return false; }
/** * Load a plugin * * Injects the controller object into the plugin prior to returning it, if * available, and if the plugin supports it. * * @param mixed $plugin * @param array|null $options * @return mixed */ public function load($plugin, array $options = null) { $helper = parent::load($plugin, $options); if (method_exists($helper, 'setController')) { if (null !== ($controller = $this->getController())) { $helper->setController($controller); } } return $helper; }
/** * Create a route from array specifications. * * @param mixed $specs * @return SimpleRouteStack */ protected function routeFromArray($specs) { if (!is_array($specs) && !$specs instanceof ArrayAccess) { throw new Exception\InvalidArgumentException(sprintf( 'Expected an array or ArrayAccess; received "%s"', (is_object($specs) ? get_class($specs) : gettype($specs)) )); } if (!isset($specs['type'])) { throw new Exception\InvalidArgumentException('Missing "type" option'); } elseif (!isset($specs['options'])) { throw new Exception\InvalidArgumentException('Missing "name" option'); } $route = $this->pluginBroker->load($specs['type'], $specs['options']); return $route; }