Components_Component_Factory::createRemote PHP Method

createRemote() public method

Create a representation for a remote component.
public createRemote ( string $name, string $stability, string $channel, Horde_Pear_Remote $remote ) : Components_Component_Remote
$name string The name of the component.
$stability string The stability of the component.
$channel string The component channel.
$remote Horde_Pear_Remote The remote server handler.
return Components_Component_Remote The remote component.
    public function createRemote($name, $stability, $channel, Horde_Pear_Remote $remote)
    {
        return new Components_Component_Remote($name, $stability, $channel, $remote, $this->_client, $this->_config, $this);
    }

Usage Example

Esempio n. 1
0
 /**
  * Try to resolve the given name and channel into a component.
  *
  * @param string $name    The name of the component.
  * @param string $channel The channel origin of the component.
  * @param array  $options Additional options.
  *
  * @return Components_Component|boolean The component if the name could be
  *                                      resolved.
  */
 public function resolveName($name, $channel, $options)
 {
     foreach ($this->_getAttempts($options) as $attempt) {
         if ($attempt == 'git' && $channel == 'pear.horde.org') {
             try {
                 $path = $this->_root->getPackageXml($name);
                 return $this->_factory->createSource(dirname($path));
             } catch (Components_Exception $e) {
             }
         }
         if ($attempt == 'snapshot') {
             if ($local = $this->_identifyMatchingLocalPackage($name, $channel, $options)) {
                 return $this->_factory->createArchive($local);
             }
         }
         if (!empty($options['allow_remote'])) {
             $remote = $this->_getRemote($channel);
             if ($remote->getLatestRelease($name, $attempt)) {
                 return $this->_factory->createRemote($name, $attempt, $channel, $remote);
             }
         }
     }
     return false;
 }