Ejemplo n.º 1
0
    /**
     * Add a Call object to the CallChain
     * 
     * @param mixed $call           Either a Call object, or a table name (from which a Call object will be created)
     * @param array $plugins        (Optional) An array of plugins
     * 
     * @return void
     */
    public function push($call, array $plugins = array())
    {
        if (! ($call instanceof Call))
        {
            $table       = (string) $call;
            $call        = new Call();
            $call->table = $table;
        }
        
        foreach ($plugins as $plugin)
        {
            $call->apply($plugin);
        }

        $this->_calls[] = $call;

        return;
    }
Ejemplo n.º 2
0
    public function Me()
    {
        $plugins = func_get_args();
        
        if (empty($plugins))
        {
            return $this;       // shortcut
        }
        
        $cluster = new Cluster($this->_callChain);
        
        $call = new Call();
        foreach ($plugins as $plugin)
        {
            $call->apply($plugin);
        }
        
        $cluster->_callChain->push($call, $plugins);        

        return $cluster;
    }