Lisphp_Runtime_Function::call PHP Method

call() public static method

public static call ( $func, array $args )
$args array
    public static function call($func, array $args)
    {
        if ($func instanceof self) {
            return $func->execute($args);
        } else {
            if (is_callable($func) && is_object($func)) {
                return call_user_func_array($func, $args);
            }
        }
        throw new InvalidArgumentException('expected callable value');
    }

Usage Example

コード例 #1
0
ファイル: Map.php プロジェクト: sysatom/workflow
 protected function execute(array $arguments)
 {
     if (!($function = array_shift($arguments))) {
         throw new InvalidArgumentException('missing function');
     } elseif (!isset($arguments[0])) {
         throw new InvalidArgumentException('least one list is required');
     }
     $map = array();
     foreach ($arguments as &$list) {
         if ($list instanceof IteratorAggregate) {
             $list = $list->getIterator();
         } elseif (is_array($list)) {
             $list = new ArrayIterator($list);
         } elseif (!$list instanceof Iterator) {
             throw new InvalidArgumentException('expected list');
         }
     }
     $map = array();
     while (true) {
         $values = array();
         foreach ($arguments as $it) {
             if (!$it->valid()) {
                 break 2;
             }
             $values[] = $it->current();
             $it->next();
         }
         $map[] = Lisphp_Runtime_Function::call($function, $values);
     }
     return new Lisphp_List($map);
 }
All Usage Examples Of Lisphp_Runtime_Function::call