Components_Dependencies::getComponentFactory PHP Method

getComponentFactory() public method

Returns a component instance factory.
public getComponentFactory ( ) : Components_Component_Factory
return Components_Component_Factory The component factory.
    public function getComponentFactory();

Usage Example

Example #1
0
 /**
  * Determine the requested component.
  *
  * @param array $arguments The arguments.
  *
  * @return array Two elements: The selected component as
  *               Components_Component instance and optionally a string
  *               representing the path to the specified source component.
  */
 private function _determineComponent($arguments)
 {
     if (isset($arguments[0])) {
         if (in_array($arguments[0], $this->_actions['missing_argument'])) {
             return;
         }
         if ($this->_isPackageXml($arguments[0])) {
             $this->_config->shiftArgument();
             return array($this->_dependencies->getComponentFactory()->createSource(dirname($arguments[0])), dirname($arguments[0]));
         }
         if (!in_array($arguments[0], $this->_actions['list'])) {
             if ($this->_isDirectory($arguments[0])) {
                 $this->_config->shiftArgument();
                 return array($this->_dependencies->getComponentFactory()->createSource($arguments[0]), $arguments[0]);
             }
             $options = $this->_config->getOptions();
             if (!empty($options['allow_remote'])) {
                 $result = $this->_dependencies->getComponentFactory()->getResolver()->resolveName($arguments[0], 'pear.horde.org', $options);
                 if ($result !== false) {
                     $this->_config->shiftArgument();
                     return array($result, '');
                 }
             }
             throw new Components_Exception(sprintf(Components::ERROR_NO_ACTION_OR_COMPONENT, $arguments[0]));
         }
     }
     $cwd = getcwd();
     if ($this->_isDirectory($cwd) && $this->_containsPackageXml($cwd)) {
         return array($this->_dependencies->getComponentFactory()->createSource($cwd), $cwd);
     }
     throw new Components_Exception(Components::ERROR_NO_COMPONENT);
 }