Add Menu to a Collection

@param string
@param callable $callable
@return \AvoRed\Framework\AdminMenu\Builder
188198
public function add($key, $callable)
    {
        $menu = new AdminMenu($callable);

        $this->adminMenu->put($key, $menu);

        return $this;
    }
180798
public function call(callable $callable, array $parameters = [])
	{
		if(is_array($callable))
		{
			$reflection = new ReflectionMethod($callable[0], $callable[1]);
		}
		else
		{
			$reflection = new ReflectionFunction($callable);
		}

		return $callable(...$this->resolveParameters($reflection->getParameters(), $parameters));
	}
416039
public function alter(\Closure $callable)
    {
        $schema = new Schema\AlterSchema($this->table);
        $callable = $callable->bindTo($schema);

        $callable($this->database);

        return $this->execSchema($schema);
    }
1374609
public function each(callable $callable)
    {
        foreach ($this->attributes as $key => $value)
        {
            if($callable($value, $key) === false)
                break;
        }

        return $this;
    }
199431
private function createReflection(callable $callable)
    {
        if (is_string($callable) && strpos($callable, '::')) {
            $callable = explode('::', $callable);
        }

        if (is_array($callable)) {
            return new ReflectionMethod($callable[0], $callable[1]);
        }

        if (is_object($callable) && method_exists($callable, '__invoke')) {
            return new ReflectionMethod($callable, '__invoke');
        }

        return new ReflectionFunction($callable);
    }
1146001
public static function create($callable)
    {
        // Closure
        if ($callable instanceof \Closure) {
            return new \ReflectionFunction($callable);
        }

        // Array callable
        if (is_array($callable)) {
            list($class, $method) = $callable;

            if (! method_exists($class, $method)) {
                throw NotCallableException::fromInvalidCallable($callable);
            }

            return new \ReflectionMethod($class, $method);
        }

        // Callable object (i.e. implementing __invoke())
        if (is_object($callable) && method_exists($callable, '__invoke')) {
            return new \ReflectionMethod($callable, '__invoke');
        }

        // Callable class (i.e. implementing __invoke())
        if (is_string($callable) && class_exists($callable) && method_exists($callable, '__invoke')) {
            return new \ReflectionMethod($callable, '__invoke');
        }

        // Standard function
        if (is_string($callable) && function_exists($callable)) {
            return new \ReflectionFunction($callable);
        }

        throw new NotCallableException(sprintf(
            '%s is not a callable',
            is_string($callable) ? $callable : 'Instance of ' . get_class($callable)
        ));
    }
1275156
public function search(callable $callable)
    {
        foreach ($this as $key => $row) {
            if (call_user_func_array($callable, [$row, $key])) {
                return $row;
            }
        }

        return null;
    }
1098887
public function extend($name, callable $callable)
    {
        $name = $name == '*' ? '*.*.*' : $name;
        $this->checkSegmentCount($name);
        $this->_extensions[$name] = $callable;

        return $this;
    }
919333
public static function call(callable $callable, $args=[])
    {
        if (!is_array($args)) {
            $args = [$args];
        }

        switch (count($args)) {
            case 0:
                return call_user_func($callable);
            case 1:
                return call_user_func($callable, $args[0]);
            case 2:
                return call_user_func($callable, $args[0], $args[1]);
            case 3:
                return call_user_func($callable, $args[0], $args[1], $args[2]);
            case 4:
                return call_user_func($callable, $args[0], $args[1], $args[2], $args[3]);
        }

        return call_user_func_array($callable, $args);
    }
100421
public function addPermission($key, $callable = null)
    {
        if (null !== $callable) {
            $permission = new Permission($callable);
            $permission->key($key);

            $this->permissionList->put($key, $permission);
        } else {
            $permission = new Permission();

            $permission->key($key);
            $this->permissionList->put($key, $permission);
        }

        return $permission;
    }
863956
public function wrap($callable, $params = [])
    {
        $kernel = new ClosureHttpKernel();

        if (is_callable($callable)) {
            $middleware = $callable($kernel);
        } else {
            // Add kernel as 'app' parameter
            $params = ['app' => $kernel] + $params;
            $makeMethod = method_exists($this->container, 'makeWith') ?  'makeWith' : 'make';
            $middleware = $this->container->$makeMethod($callable, $params);
        }

        if ($middleware instanceof TerminableInterface) {
            return new TerminableClosureMiddleware($kernel, $middleware);
        }

        return new ClosureMiddleware($kernel, $middleware);
    }
685889
public function setCallable($callable)
    {
        $matches = array();
        if (is_string($callable) && preg_match('!^([^\:]+)\:([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)$!', $callable, $matches)) {
            $class = $matches[1];
            $method = $matches[2];
            $callable = function() use ($class, $method) {
                static $obj = null;
                if ($obj === null) {
                    $obj = new $class;
                }
                return call_user_func_array(array($obj, $method), func_get_args());
            };
        }

        if (!is_callable($callable)) {
            throw new \InvalidArgumentException('Route callable must be callable');
        }

        $this->callable = $callable;
    }
798431
public function withTransaction(callable $callable)
    {
        try {
            $nested = $this->transactionStarted;
            if (!$nested) {
                $this->startTransaction();
            }
            $this->transactionStarted = true;
            $result = $callable();
            if (!$nested) {
                $this->commit();
            }
            $this->transactionStarted = $nested;
            return $result;
        } catch (Throwable $e) {
            if ($this->transactionStarted) {
                $this->rollback();
                $this->transactionStarted = false;
            }
            throw $e;
        }
    }
1278846
public function addEvent($event, $callable)
    {
        if (!is_callable($callable)) {
            throw new \InvalidArgumentException(
                sprintf(
                    '%s expects parameter 2 to be callable, %s given: %s',
                    __METHOD__,
                    gettype($callable),
                    print_r($callable, true)
                )
            );
        }

        if (!isset($this->events[$event])) {
            $this->events[$event] = array();
        }

        $this->events[$event][] = $callable;
    }
872924
public function addMethod($name, $callable)
    {
        if (is_string($name) && strpos($name, ',') !== false) {
            $name = explode(',', $name);
        }
        if (is_array($name)) {
            foreach ($name as $h) {
                $this->addMethod($h, $callable);
            }

            return $this;
        }
        if (is_object($callable) && !is_callable($callable)) {
            $callable = array($callable, $name);
        }
        if ($this->hasMethod($name)) {
            throw $this->exception('Registering method twice');
        }
        $this->addHook('method-'.$name, $callable);

        return $this;
    }
938181
public function traverseOrders(callable $callable)
    {
        foreach ($this->orders() as $expr) {
            /**
             * @param  OrderInterface           $expr The iterated order expression object.
             * @param  OrderCollectionInterface $this The context of the traversal.
             * @return void
             */
            $callable($expr, $this);
            if ($expr instanceof OrderCollectionInterface) {
                $expr->traverseOrders($callable);
            }
        }

        return $this;
    }
1225499
public function _and(callable $callable = null)
    {
        $history = $this->opIsAnd;
        $this->opIsAnd = true;

        if (is_callable($callable)) {
            $this->lBrackets();
            $callable();
            $this->rBrackets();
            $this->opIsAnd = $history;
        }

        return $this;
    }