Rinvex\Repository\Repositories\BaseRepository::executeCallback PHP Method

executeCallback() protected method

Execute given callback and return the result.
protected executeCallback ( string $class, string $method, array $args, Closure $closure ) : mixed
$class string
$method string
$args array
$closure Closure
return mixed
    protected function executeCallback($class, $method, $args, Closure $closure)
    {
        $skipUri = $this->getContainer('config')->get('rinvex.repository.cache.skip_uri');
        // Check if cache is enabled
        if ($this->getCacheLifetime() && !$this->getContainer('request')->has($skipUri)) {
            return $this->cacheCallback($class, $method, $args, $closure);
        }
        // Cache disabled, just execute qurey & return result
        $result = call_user_func($closure);
        // We're done, let's clean up!
        $this->resetRepository();
        return $result;
    }