コード例 #1
0
ファイル: class.CallChain.php プロジェクト: Goodgulf/nodemesh
    /**
     * 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;
    }
コード例 #2
0
ファイル: class.NodeCore.php プロジェクト: Goodgulf/nodemesh
    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;
    }