public static function castFile(FileInterface $file, array $a, Stub $stub, $isNested, $filter = 0) { $a[Caster::PREFIX_PROTECTED . 'mimetype'] = $file->getMimeType(); $a[Caster::PREFIX_PROTECTED . 'size'] = $file->getSize(); $a[Caster::PREFIX_VIRTUAL . 'sizeFormatted'] = $file->getSizeFormatted(); return $a; }
/** * Set our state as valid by writing the current date/time to the * app/cache/dbcheck.ts file. * * We only want to do these checks once per hour, per session, since it's * pretty time consuming… Unless specifically requested. */ public function setCheckExpiry() { try { $this->expired = false; $this->cacheFile->put(Carbon::now()->getTimestamp()); } catch (IOException $e) { // Something went wrong } }
/** * {@inheritdoc} */ public function __construct(FileInterface $file, $message = '') { $this->unstackableFile = $file; parent::__construct($message ?: 'File is not stackable: ' . $file->getFullPath(), 0); }
private function getCodeMirrorPlugins(FileInterface $file) { switch (strtolower($file->getExtension())) { case 'twig': case 'html': case 'htm': return ['xml', 'javascript', 'css', 'htmlmixed']; case 'php': return ['matchbrackets', 'javascript', 'css', 'htmlmixed', 'clike', 'php']; case 'yml': case 'yaml': return ['yaml']; case 'md': case 'markdown': return ['markdown']; case 'css': case 'less': return ['css']; case 'js': return ['javascript']; default: return []; } }