Flarum\Asset\RevisionCompiler::getFile PHP Method

getFile() public method

public getFile ( )
    public function getFile()
    {
        $old = $current = $this->getRevision();
        $ext = pathinfo($this->filename, PATHINFO_EXTENSION);
        $file = $this->path . '/' . substr_replace($this->filename, '-' . $old, -strlen($ext) - 1, 0);
        if ($this->watch || !$old) {
            $cacheDifferentiator = [$this->getCacheDifferentiator()];
            foreach ($this->files as $source) {
                $cacheDifferentiator[] = [$source, filemtime($source)];
            }
            $current = hash('crc32b', serialize($cacheDifferentiator));
        }
        $exists = file_exists($file);
        if (!$exists || $old !== $current) {
            if ($exists) {
                unlink($file);
            }
            $file = $this->path . '/' . substr_replace($this->filename, '-' . $current, -strlen($ext) - 1, 0);
            if ($content = $this->compile()) {
                $this->putRevision($current);
                file_put_contents($file, $content);
            } else {
                return;
            }
        }
        return $file;
    }