@param string       $action The type of query.
@param string       $table  The table to take $action on..
@param string|array $values The appropriate values for a given query.

@return array|false|int
766257
private function exec($action, $table, $values)
    {
        $action = strtolower($action);
        if (!isset($this->stmt[$action][$table])) {
            if ($this->transaction === false && $action != 'select') {
                $this->transaction = true;
                $this->db->exec('BEGIN IMMEDIATE');
            }
            switch ($action) {
                case 'select':
                    if ($table == 'sitemap') {
                        $stmt = $this->db->prepare('SELECT docid, hash, updated, deleted FROM sitemap WHERE path = ?', 'assoc');
                    }
                    break;
                case 'insert':
                    if ($table == 'search') {
                        $stmt = $this->db->insert('search', array('path', 'title', 'description', 'keywords', 'content'));
                    } elseif ($table == 'sitemap') {
                        $stmt = $this->db->insert('sitemap', array('docid', 'category_id', 'path', 'info', 'image', 'content', 'hash', 'updated', 'deleted'));
                    } elseif ($table == 'categories') {
                        $stmt = $this->db->insert('categories', array('category', 'parent'));
                    }
                    break;
                case 'update':
                    if ($table == 'search') {
                        $stmt = $this->db->update('search', 'docid', array('path', 'title', 'description', 'keywords', 'content'));
                    } elseif ($table == 'sitemap') {
                        $stmt = $this->db->update('sitemap', 'docid', array('category_id', 'path', 'info', 'image', 'content', 'hash', 'updated', 'deleted'));
                    }
                    break;
                case 'delete':
                    if ($table == 'search') {
                        $stmt = $this->db->prepare('DELETE FROM search WHERE docid = ?');
                    } elseif ($table == 'sitemap') {
                        $stmt = $this->db->prepare('DELETE FROM sitemap WHERE docid = ?');
                    }
                    break;
            }
            $this->stmt[$action][$table] = (isset($stmt)) ? $stmt : null;
        }
        $result = $this->db->execute($this->stmt[$action][$table], $values);
        if ($action == 'select') {
            $row = $this->db->fetch($this->stmt[$action][$table]);

            return (!empty($row)) ? $row : false;
        } else {
            return $result;
        }
    }
353618
public function doAction($action)
    {
        $controller = $this->getOption('hooks-controller');
        $instance = $this->getControllerInstance($controller);

        if (is_object($instance) && method_exists($instance, $action)) {
            $response = call_user_func([$instance, $action]);
        }

        $this->setAction('');

        return isset($response);
    }
575001
public function performAction($controller, $action) {
		// Replace namespace with directory separator
		$controllerFile = str_replace("\\", DIRECTORY_SEPARATOR, $controller);

		// Check if controller exists
		if ( false == is_file( $controllerLocation = APP . 'Controllers/' . $controllerFile . '.php' ) )
			throw new ControllerNotFoundException();

		// Include and init the controller
		$controllerClass = "\\Application\\Controllers\\{$controller}";
		$controllerObj = new $controllerClass($this);

		// Check if the action exists
		if ( 'Errors' != $controller && false == method_exists($controllerObj, $action.= "Action" ) )
			throw new ActionNotFoundException();
		// Check if the error display action exists
		elseif ( $controller == $this->defaultRoute['_controller'] && false == method_exists($controllerObj, $action = "display" . $action ) )
			throw new ErrorActionNotFoundException();

		// Run the action
		$data = $controllerObj->{$action}();

		// Data fetching
		if ( false === $controllerObj->__returnActionPerformed ):
			// Format returned data
			if ( false == is_array( $data ) )
				$data = (array) $data;

			// Start reflection for data loading
			$ref = new \ReflectionObject($controllerObj);
			$properties = $ref->getProperties(\ReflectionProperty::IS_PUBLIC);
			$controllerData = array();

			// Get public data
			foreach ( $properties as $property ):
				// Don't add internal variabels
				if ( '__returnActionPerformed' == $property->getName() )
					continue;

				// Add property to controller data
				$controllerData[$property->getName()] = $property->getValue($controllerObj);
			endforeach;

			// Merge data from controller and action
			$data = array_merge($controllerData, $data);
		endif;

		// Return the object
		return $data;
	}
125908
private function supportsAction($action)
    {
        if (null === $this->getSupportedActions()) {
            return true;
        }

        return in_array($action, $this->getSupportedActions());
    }
1013622
public function update(string $table = null, array $values = null): Query\Update
    {
        return new Query\Update($table, $values, $this->getConfigKey());
    }
377561
public function perform($action, $table, $body, $options = [])
    {
        $query = $this->createQuery($action, $table, $options)->body($body);

        return $this->createRequest($query);
    }
1113425
public function action($action, $parameters = [], array $query = [])
    {
        $callback = function (Route $route) use ($action) {

            return $route->getActionName() === $action && $route->acceptedVerb('GET');
        };

        $route = $this->getRouteCollection()->firstOrFail($callback);

        return $this->to($route->toUri((array) $parameters), $query);
    }
922080
protected function convertToControllerAction($action)
    {
        if (is_string($action)) {
            $action = ['uses' => $action];
        }

        // Here we'll merge any group "uses" statement if necessary so that the action
        // has the proper clause for this property. Then we can simply set the name
        // of the controller on the action and return the action array for usage.
        if (! empty($this->groupStack)) {
            $action['uses'] = $this->prependGroupNamespace($action['uses']);
        }

        // Here we will set this controller name on the action array just so we always
        // have a copy of it for reference if we need it. This can be used while we
        // search for a controller name or do some other type of fetch operation.
        $action['controller'] = $action['uses'];

        return $action;
    }
603650
protected function findCallable(array $action)
	{
		return array_first($action, function($key, $value)
		{
			return is_callable($value) && is_numeric($key);
		});
	}
628388
protected function execute(string $action)
    {
        if (!$this->getCollectionName()) {
            return false;
        }

        $options = [
            'writeConcern' => new WriteConcern($this->getWriteConcern()),
        ];

        if ($result = $this->getDataMapper()->$action($this, $options)) {
            $this->syncOriginalAttributes();
        }

        return $result;
    }
885771
private function getActionSql($action, $tab, $sql)
    {
        $result = 'ALTER TABLE `' . $tab . '` ';
        $action = strtolower($action);
        $keyField = '`?\w`?(?:\(\d+\))?';//matches `name`(10)
        $keyFieldList = '(?:' . $keyField . '(?:,\s?)?)+';//matches `name`(10),`desc`(255)

        if (preg_match('/((?:PRIMARY )|(?:UNIQUE )|(?:FULLTEXT ))?KEY `?(\w+)?`?\s(\(' . $keyFieldList . '\))/i', $sql, $m)) {   //key and index operations
            $type = strtolower(trim($m[1]));
            $name = trim($m[2]);
            $fields = trim($m[3]);

            switch ($action) {
                case 'drop':
                    if ($type == 'primary') {
                        $result .= 'DROP PRIMARY KEY';
                    } else {
                        $result .= 'DROP INDEX `' . $name . '`';
                    }
                    break;
                case 'add':
                    if ($type == 'primary') {
                        $result .= 'ADD PRIMARY KEY ' . $fields;
                    } elseif ($type == '') {
                        $result .= 'ADD INDEX `' . $name . '` ' . $fields;
                    } else {
                        $result .= 'ADD ' . strtoupper($type) . ' `' . $name . '` ' . $fields;//fulltext or unique
                    }
                    break;
                case 'modify':
                    if ($type == 'primary') {
                        $result .= 'DROP PRIMARY KEY, ADD PRIMARY KEY ' . $fields;
                    } elseif ($type == '') {
                        $result .= 'DROP INDEX `' . $name . '`, ADD INDEX `' . $name . '` ' . $fields;
                    } else {
                        $result .= 'DROP INDEX `' . $name . '`, ADD ' . strtoupper($type) . ' `' . $name . '` ' . $fields;//fulltext or unique
                    }
                    break;

            }
        } else // fields operations
        {
            $sql = rtrim(trim($sql), ',');
            $result .= strtoupper($action);
            if ($action == 'drop') {
                $spacePos = strpos($sql, ' ');
                $result .= ' ' . substr($sql, 0, $spacePos);
            } else {
                $result .= ' ' . $sql;
            }
        }

        return $result;
    }
1078031
protected function runActionMethod($action, $vars = array()) {
		return call_user_func_array(
		    array($this, $action),
            $this->getActionArguments($action, $vars)
        );
	}
1074174
public static function runAction($db, $model, $action)
    {
        $res = $db->getConnection()->select($action['sql'], [], false);
        if ($action['action'] === 'create_table') {
            $model->onCreate();
        }
        return $res;
    }
1138401
public function uses($action)
    {
        $action = is_string($action) ? $this->addGroupNamespaceToStringUses($action) : $action;

        return $this->setAction(array_merge($this->action, $this->parseAction([
            'uses' => $action,
            'controller' => $action,
        ])));
    }
277822
public function checkMethod($action): bool {
        $methods = $this->methods();
        return !isset($methods[$action]) ||
            in_array(app('request')->method(), $methods[$action]);
    }
396812
public function query(string $sql, array $values = []): int
    {
        return $this->dbConnection->prepare($sql)
                ->execute($values)
                ->count();
    }
1228334
protected function findActionClosure(array $action)
    {
        return Arr::first($action, function ($key, $value)
        {
            return is_callable($value) && is_numeric($key);
        });
    }