Find the callable in an action array.

@param  array  $action
@return callable
420225
protected static function findCallable(array $action)
    {
        return Arr::first($action, function ($value, $key) {
            return is_callable($value) && is_numeric($key);
        });
    }
1293852
public function canExecute($action)
    {
        $method  = 'can'.ucfirst($action);
        $methods = $this->getMixer()->getMethods();

        if (!isset($methods[$method]))
        {
            $actions = $this->getActions();
            $actions = array_flip($actions);

            $result = isset($actions[$action]);
        }
        else $result = $this->$method();

        return $result;
    }
955446
public function action(callable $action, $params = [], &$result = null)
    {
        return $this->db->action($action, $params, $result);
    }
1369808
private function strategy(callable $action)
    {
        $report = false;

        $tables = [
            'string' => StringModel::class,
            'text' => TextModel::class,
            'bool' => BoolModel::class,
            'float' => FloatModel::class,
            'int' => IntModel::class,
            'timestamp' => TimestampModel::class];

        foreach($tables as $type_name => $modelClass)
        {
            $wehave = $modelClass::all();

            foreach($wehave as $model)
            {
                $entity_name = $model->entity_name;
                $name        = $model->name;

                if(!$this->taxonomy->exist($entity_name))
                {
                    $action(1, $type_name, $model);
                    $report = true;
                }
                else
                {
                    $ownerType = $this->taxonomy->getType($entity_name);

                    if($ownerType->getRank() === TypeRank::OWN)
                    {
                        $action(2, $type_name, $model);
                        $report = true;
                    }
                    elseif(!$ownerType->ownExist($name))
                    {
                        $action(3, $type_name, $model);
                        $report = true;
                    }
                    elseif($ownerType->getFieldType($name) !== $this->taxonomy->getType($type_name))
                    {
                        $action(4, $type_name, $model);
                        $report = true;
                    }
                }
            }
        }

        return $report;
    }
799846
public function hasAllowableAction(Action $action)
    {
        $currentAllowableActions = $this->getAllowableActions();
        if ($currentAllowableActions === null || count($currentAllowableActions->getAllowableActions()) === 0) {
            throw new IllegalStateException('Allowable Actions are not available!');
        }

        return in_array($action, $currentAllowableActions->getAllowableActions(), false);
    }
1078031
protected function runActionMethod($action, $vars = array()) {
		return call_user_func_array(
		    array($this, $action),
            $this->getActionArguments($action, $vars)
        );
	}
1057216
protected function isActionController($action)
    {
        if ($action instanceof Closure) {
            return false;
        }

        return is_string($action) || is_string(isset($action['uses']) ? $action['uses'] : null);
    }
723794
protected function compileAction($action)
    {
        if (is_null($action)) {
            return $this->attributes;
        }

        if (is_string($action) || $action instanceof Closure) {
            $action = ['uses' => $action];
        }

        return array_merge($this->attributes, $action);
    }
164929
protected function parseAction($action)
	{
		// If the action is already a Closure instance, we will just set that instance
		// as the "uses" property, because there is nothing else we need to do when
		// it is available. Otherwise we will need to find it in the action list.
		if (is_callable($action))
		{
			return array('uses' => $action);
		}

		// If no "uses" property has been set, we will dig through the array to find a
		// Closure instance within this list. We will set the first Closure we come
		// across into the "uses" property that will get fired off by this route.
		elseif ( ! isset($action['uses']))
		{
			$action['uses'] = $this->findCallable($action);
		}

		return $action;
	}
1299247
protected function setAction($action)
    {
        $this->action = trim(strtoupper($action));

        //	Check verb aliases, set correct action allowing for closures
        if (null !== ($alias = array_get($this->verbAliases, $this->action))) {
            //	A closure?
            if (in_array($alias, Verbs::getDefinedConstants()) || !is_callable($alias)) {
                //	Set original and work with alias
                $this->originalAction = $this->action;
                $this->action = $alias;
            }
        }

        return $this;
    }
337687
public function setAction($action)
    {
        $this->action = is_string($action) ? $action : $this->$action;
        $this->prepareUrl();

        return $this;
    }
999360
private function constructAction($action, array $arguments = []): bool
    {
        if (is_callable($action)) {
            $this->pendingAction = $action;

            return true;
        } elseif (is_string($action)) {
            $actionParts = explode('@', $action);

            $controllerName = 'App\\Http\\Controllers\\' . $actionParts[0];
            $methodName = $actionParts[1];

            if (!class_exists($controllerName)) {
                throw new HTTPException('Not found', 404);
            }

            $controller = $this->container->get($controllerName);

            if (!method_exists($controller, $methodName)) {
                throw new HTTPException('Not found', 404);
            }

            $this->pendingAction = [
                'controller' => $controllerName,
                'method' => $methodName,
                'arguments' => $arguments,
            ];

            return true;
        }

        return false;
    }
64530
protected function call($action, array $parameters = [])
    {
        if ($this->batch) {

            $query = ['api_action' => $action];

            foreach ($parameters as $key => $value) {
                if ($value !== null) {
                    $query[urlencode($key)] = urlencode($value);
                }
            }

            $this->batch->addRequest($query);

            return true;
        }

        $curl = curl_init();

        if (!$curl) {
            return false;
        }

        $query = "api_key={$this->key}&api_action={$action}";

        foreach ($parameters as $key => $value) {
            if ($value !== null) {
                $query .= sprintf('&%s=%s', urlencode($key), urlencode($value));
            }
        }

        if ($this->debug) {
            return $query;
        }

        $this->options[CURLOPT_URL]            = 'https://api.linode.com/';
        $this->options[CURLOPT_POST]           = true;
        $this->options[CURLOPT_POSTFIELDS]     = $query;
        $this->options[CURLOPT_RETURNTRANSFER] = true;
        $this->options[CURLOPT_SSLVERSION]     = CURL_SSLVERSION_TLSv1_2;

        curl_setopt_array($curl, $this->options);

        $result = curl_exec($curl);

        curl_close($curl);

        $json = json_decode($result, true);

        if (!$json) {
            throw new \RuntimeException('Empty response');
        }

        $error = reset($json['ERRORARRAY']);

        if ($error) {
            throw new LinodeException($error['ERRORMESSAGE'], $error['ERRORCODE']);
        }

        return $json['DATA'];
    }
1048694
public function getActionUrl($action)
    {
        if (is_array($action->urlData) && $this->isOpenNewWindow)
        {
            $action->url = BackendUrlHelper::createByParams($action->urlData)
                ->enableEmptyLayout()
                ->enableNoActions()
                ->params
            ;
        };

        return $action->url;
    }
641340
protected function getControllerAction($action)
	{
		if (is_string($action)) $action = array('uses' => $action);

		// Here we'll get an instance of this controller dispatcher and hand it off to
		// the Closure so it will be used to resolve the class instances out of our
		// IoC container instance and call the appropriate methods on the class.
		if (count($this->groupStack) > 0)
		{
			$action['uses'] = $this->prependGroupUses($action['uses']);
		}

		// Here we'll get an instance of this controller dispatcher and hand it off to
		// the Closure so it will be used to resolve the class instances out of our
		// IoC container instance and call the appropriate methods on the class.
		$action['controller'] = $action['uses'];

		$closure = $this->getClassClosure($action['uses']);

		return array_set($action, 'uses', $closure);
	}
645173
private function getActionFromParam($action)
    {
        $action = str_replace("-", "_", $action);
        if (substr($action, -1) === "/") {
            $action = substr($action, 0, -1);
        }

        return lcfirst(Inflector::camelize($action));
    }
697146
public function call ($action, array $args = [])
    {
        $method = $action;
        $class = null;

        if (is_string($action)) {
            list($class, $method) = explode('@', $action);
        }
        elseif (is_array($action)) {
            list($class, $method) = $action; 

            if (!is_object($class)) {
                throw new ContainerException('$class must be an object');
            }

            if (!is_string($method)) {
                throw new ContainerException('$action must be a string');
            }
        }

        $reflection = $this->getActionReflection($method, $class);
        $args       = $this->getParametersDictionary($args);
        $parameters = $this->getParameters($reflection, $args);

        if (is_callable($method)) {
            return $method(...$parameters);
        }

        if(!is_object($class)) {
            $class = $this->build($class);
        }

        return $class->{$method}(...$parameters);
    }