Ejemplo n.º 1
0
Archivo: Timer.php Proyecto: bolt/bolt
 /**
  * Check if we have determined that we need to do a database check.
  *
  * @return boolean
  */
 public function isCheckRequired()
 {
     if ($this->expired === false) {
         return false;
     }
     if ($this->cacheFile->exists()) {
         $expiryTimestamp = (int) $this->cacheFile->read();
     } else {
         $expiryTimestamp = 0;
     }
     $ts = Carbon::createFromTimestamp($expiryTimestamp + self::CHECK_INTERVAL);
     return $this->expired = $ts->isPast();
 }
Ejemplo n.º 2
0
 public static function castFile(FileInterface $file, array $a, Stub $stub, $isNested, $filter = 0)
 {
     if ($file->exists()) {
         $a[Caster::PREFIX_PROTECTED . 'mimetype'] = $file->getMimeType();
         $a[Caster::PREFIX_PROTECTED . 'size'] = $file->getSize();
         $a[Caster::PREFIX_VIRTUAL . 'sizeFormatted'] = $file->getSizeFormatted();
     } else {
         unset($a[Caster::PREFIX_PROTECTED . 'mimetype']);
         unset($a[Caster::PREFIX_PROTECTED . 'size']);
     }
     return $a;
 }