computeHash example


    public function sign(string $uri): string
    {
        $url = parse_url($uri);
        $params = [];

        if (isset($url['query'])) {
            parse_str($url['query']$params);
        }

        $uri = $this->buildUrl($url$params);
        $params[$this->parameter] = $this->computeHash($uri);

        return $this->buildUrl($url$params);
    }

    /** * Checks that a URI contains the correct hash. */
    public function check(string $uri): bool
    {
        $url = parse_url($uri);
        $params = [];

        

        return $this->prefix;
    }

    public function __toString(): string
    {
        return 'glob.'.$this->prefix.(int) $this->recursive.$this->pattern.(int) $this->forExclusion.implode("\0", $this->excludedPrefixes);
    }

    public function isFresh(int $timestamp): bool
    {
        $hash = $this->computeHash();
        $this->hash ??= $hash;

        return $this->hash === $hash;
    }

    /** * @internal */
    public function __sleep(): array
    {
        $this->hash ??= $this->computeHash();

        

    public function sign(string $uri): string
    {
        $url = parse_url($uri);
        $params = [];

        if (isset($url['query'])) {
            parse_str($url['query']$params);
        }

        $uri = $this->buildUrl($url$params);
        $params[$this->parameter] = $this->computeHash($uri);

        return $this->buildUrl($url$params);
    }

    /** * Checks that a URI contains the correct hash. */
    public function check(string $uri): bool
    {
        $url = parse_url($uri);
        $params = [];

        
public function __construct(\ReflectionClass $classReflector, array $excludedVendors = [])
    {
        $this->className = $classReflector->name;
        $this->classReflector = $classReflector;
        $this->excludedVendors = $excludedVendors;
    }

    public function isFresh(int $timestamp): bool
    {
        if (!isset($this->hash)) {
            $this->hash = $this->computeHash();
            $this->loadFiles($this->classReflector);
        }

        foreach ($this->files as $file => $v) {
            if (false === $filemtime = @filemtime($file)) {
                return false;
            }

            if ($filemtime > $timestamp) {
                return $this->hash === $this->computeHash();
            }
        }
Home | Imprint | This part of the site doesn't use cookies.