public function add($alias, $factory = null, array $declared = null)
    {
        // Setup links, if necessary
        if (is_array($alias)) {
            $links = $alias;
            $alias = $alias[0];
            unset($links[0]);
        }

        $this->set("$alias", $factory);

        // Setup any declared dependencies
        if ($declared) {
            $this->set("_declarations.$alias", $declared);
        }

        // Add Links
        if (!empty($links)) {
            foreach ($links as $link) {
                $this->set("$link", "_michaels_link_$alias");
            }
        }

        return $this;
    }
public function add($alias, $factory = null, array $declared = null)
    {
        // Setup links, if necessary
        if (is_array($alias)) {
            $links = $alias;
            $alias = $alias[0];
            unset($links[0]);
        }

        $this->set("$alias", $factory);

        // Setup any declared dependencies
        if ($declared) {
            $this->set("_declarations.$alias", $declared);
        }

        // Add Links
        if (!empty($links)) {
            foreach ($links as $link) {
                $this->set("$link", "_michaels_link_$alias");
            }
        }

        return $this;
    }
public function add ( $ alias , $ factory = null , array $ declared = null ) { // Setup links, if necessary if ( is_array ( $ alias ) ) { $ links = $ alias ; $ alias = $ alias [ 0 ] ; unset ( $ links [ 0 ] ) ; } $ this -> set ( "$alias" , $ factory ) ; // Setup any declared dependencies if ( $ declared ) { $ this -> set ( "_declarations.$alias" , $ declared ) ; } // Add Links if ( ! empty ( $ links ) ) { foreach ( $ links as $ link ) { $ this -> set ( "$link" , "_michaels_link_$alias" ) ; } } return $ this ; }
Adds a dependency to the manager

$factory can be a:
string      Full class name for a new object each time
callable    Factory to create new object (passed manager)
object      The exact object to be returned

@param string $alias
@param callable|string|object $factory
@param array $declared
@return $this
Adds a dependency to the manager