lib/Yucca/Component/SourceManager.php
public function getSource($sourceName)
    {
        if (false === isset($this->sources[$sourceName])) {
            if (false === isset($this->sourceConfig[$sourceName]['handlers'])) {
                throw new \InvalidArgumentException("\"$sourceName\" name has not been configured");
            }

            $sources = array();
            foreach ($this->sourceConfig[$sourceName]['handlers'] as $sourceConfig) {
                $params = array_merge($this->sourceConfig[$sourceName]['default_params'], $sourceConfig);
                $sources[] = $this->getFactory($sourceConfig['type'])->getSource($sourceName, $params);
            }

            if (1 === count($sources)) {
                $this->sources[$sourceName] = current($sources);
            } else {
                $this->sources[$sourceName] = $this->getFactory('chain')->getSource($sourceName, $this->sourceConfig[$sourceName]['default_params'], $sources);
            }
        }

        return $this->sources[$sourceName];
    }
public function getSource($sourceName)
    {
        if (false === isset($this->sources[$sourceName])) {
            if (false === isset($this->sourceConfig[$sourceName]['handlers'])) {
                throw new \InvalidArgumentException("\"$sourceName\" name has not been configured");
            }

            $sources = array();
            foreach ($this->sourceConfig[$sourceName]['handlers'] as $sourceConfig) {
                $params = array_merge($this->sourceConfig[$sourceName]['default_params'], $sourceConfig);
                $sources[] = $this->getFactory($sourceConfig['type'])->getSource($sourceName, $params);
            }

            if (1 === count($sources)) {
                $this->sources[$sourceName] = current($sources);
            } else {
                $this->sources[$sourceName] = $this->getFactory('chain')->getSource($sourceName, $this->sourceConfig[$sourceName]['default_params'], $sources);
            }
        }

        return $this->sources[$sourceName];
    }
public function getSource ( $ sourceName ) { if ( false === isset ( $ this -> sources [ $ sourceName ] ) ) { if ( false === isset ( $ this -> sourceConfig [ $ sourceName ] [ 'handlers' ] ) ) { throw new \ InvalidArgumentException ( "\"$sourceName\" name has not been configured" ) ; } $ sources = array ( ) ; foreach ( $ this -> sourceConfig [ $ sourceName ] [ 'handlers' ] as $ sourceConfig ) { $ params = array_merge ( $ this -> sourceConfig [ $ sourceName ] [ 'default_params' ] , $ sourceConfig ) ; $ sources [ ] = $ this -> getFactory ( $ sourceConfig [ 'type' ] ) -> getSource ( $ sourceName , $ params ) ; } if ( 1 === count ( $ sources ) ) { $ this -> sources [ $ sourceName ] = current ( $ sources ) ; } else { $ this -> sources [ $ sourceName ] = $ this -> getFactory ( 'chain' ) -> getSource ( $ sourceName , $ this -> sourceConfig [ $ sourceName ] [ 'default_params' ] , $ sources ) ; } } return $ this -> sources [ $ sourceName ] ; }
Get a source by it's name
@param string $sourceName
@return \Yucca\Component\Source\SourceInterface
@throws \InvalidArgumentException
Get a source by it s name