示例#1
0
 protected function load()
 {
     if (!is_callable($this->callback)) {
         $cache = new Watch($this->temp . '.cache');
         if (!$cache->isWatching() || ($this->prod || $cache->hasChanged())) {
             $builder = $this->getValidatorCode();
             $builder->writeTo($this->temp);
         }
         $data = (require $this->temp);
         foreach ($data as $key => $value) {
             $this->{$key} = $value;
         }
         $cache->watchFiles($this->files);
         $cache->watchDirs($this->dirs);
         $cache->watch();
     }
 }
示例#2
0
 protected function load()
 {
     if (is_callable($this->callback)) {
         return;
     }
     $cache = new Watch($this->temp . '.cache');
     if ($cache->isWatching() && ($this->prod || !$cache->hasChanged())) {
         require $this->temp;
         return;
     }
     $builder = $this->getValidatorCode();
     $builder->writeTo($this->temp);
     require $this->temp;
     $cache->watchFiles($this->files);
     $cache->watchDirs($this->dirs);
     $cache->watch();
 }