Psecio\Gatekeeper\Gatekeeper::__callStatic PHP Method

__callStatic() public static method

Handle undefined static function calls
public static __callStatic ( string $name, arrya $args ) : mixed
$name string Function name
$args arrya Arguments set
return mixed Boolean false if function not matched, otherwise Model instance
    public static function __callStatic($name, $args)
    {
        // find the action first
        $action = 'find';
        foreach (self::$actions as $a) {
            if (strstr($name, $a) !== false) {
                $action = $a;
            }
        }
        if ($action == 'find') {
            $action = new \Psecio\Gatekeeper\Handler\FindBy($name, $args, self::$datasource);
        } elseif ($action == 'create') {
            $action = new \Psecio\Gatekeeper\Handler\Create($name, $args, self::$datasource);
        } elseif ($action == 'delete') {
            $action = new \Psecio\Gatekeeper\Handler\Delete($name, $args, self::$datasource);
        } elseif ($action == 'save') {
            $action = new \Psecio\Gatekeeper\Handler\Save($name, $args, self::$datasource);
        } elseif ($action == 'clone') {
            $action = new \Psecio\Gatekeeper\Handler\CloneInstance($name, $args, self::$datasource);
        } elseif ($action == 'count') {
            $action = new \Psecio\Gatekeeper\Handler\Count($name, $args, self::$datasource);
        }
        return $action->execute();
    }