"라라벨 Compiler"의 두 판 사이의 차이

잔글 (Jmnote 사용자가 라라벨 Compiler.php 문서를 라라벨 Compiler 문서로 옮겼습니다)
4번째 줄: 4번째 줄:
<source lang='php'>
<source lang='php'>
<?php
<?php
namespace Illuminate\View\Compilers;
namespace Illuminate\View\Compilers;
use InvalidArgumentException;
use InvalidArgumentException;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Filesystem\Filesystem;
abstract class Compiler
abstract class Compiler
{
{
     protected $files;
     protected $files;
     protected $cachePath;
     protected $cachePath;
     public function __construct(Filesystem $files, $cachePath)
     public function __construct(Filesystem $files, $cachePath)
     {
     {
23번째 줄: 19번째 줄:
         $this->cachePath = $cachePath;
         $this->cachePath = $cachePath;
     }
     }
     public function getCompiledPath($path)
     public function getCompiledPath($path)
     {
     {
         return $this->cachePath.'/'.sha1($path).'.php';
         return $this->cachePath.'/'.sha1($path).'.php';
     }
     }
     public function isExpired($path)
     public function isExpired($path)
     {
     {
         $compiled = $this->getCompiledPath($path);
         $compiled = $this->getCompiledPath($path);
        if (! $this->files->exists($compiled)) {
                                if (! $this->files->exists($compiled)) {
             return true;
             return true;
         }
         }

2016년 8월 29일 (월) 09:57 판

1 개요

라라벨 Compiler.php
<?php
namespace Illuminate\View\Compilers;
use InvalidArgumentException;
use Illuminate\Filesystem\Filesystem;
abstract class Compiler
{
    protected $files;
    protected $cachePath;
    public function __construct(Filesystem $files, $cachePath)
    {
        if (! $cachePath) {
            throw new InvalidArgumentException('Please provide a valid cache path.');
        }
        $this->files = $files;
        $this->cachePath = $cachePath;
    }
    public function getCompiledPath($path)
    {
        return $this->cachePath.'/'.sha1($path).'.php';
    }
    public function isExpired($path)
    {
        $compiled = $this->getCompiledPath($path);
                                if (! $this->files->exists($compiled)) {
            return true;
        }
        $lastModified = $this->files->lastModified($path);
        return $lastModified >= $this->files->lastModified($compiled);
    }
}

2 같이 보기

3 참고 자료

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}