public function testReadableinPhar() { $phar = $this->getFile('test.phar.gz'); $wrapped = 'phar://' . str_replace(DIRECTORY_SEPARATOR, '/', (string) $phar) . '/Imagine/Exception/Exception.php'; $file = new File($wrapped); $this->assertTrue($file->isReadable()); $this->assertTrue($file->exists()); }
public function addErrorDocument($httpErrorCode, File $document) { if ($document->isReadable()) { $this->errorDocuments[$httpErrorCode] = $document; } else { throw new \InvalidArgumentException($document . ' ist nicht lesbar.'); } return $this; }
protected function moveEpisodeVideo($episode, File $video, $packageDir) { $targetFile = $this->getTargetFile($episode); if (!$video->isWriteable() || !$video->isReadable()) { // klappt leider nicht $this->log(' Datei wird vermutlich gerade entpackt'); return; } $this->log(' Verschiebe: ' . $video . ' nach ' . $targetFile . '..'); /* Ziel erstellen */ $targetFile->getDirectory()->make(Dir::PARENT | DIR::ASSERT_EXISTS); if ($video->move($targetFile)) { $this->log(' verschoben.'); $episode->setExtension($video->getExtension()); $episode->setStatus(Status::MOVED); $this->cleanup($packageDir); } return $episode; }
/** * @param int $startLine 1-basierend */ public function getSourceCode(File $file, $startLine, $endLine) { $extracter = new \Psc\Code\Extracter(); if (!$file->isReadable()) { throw new \Psc\Exception('Body der Funktion/Methode ' . $this->getName() . ' kann nicht ermittelt werden, da "' . $file . '" nicht lesbar ist.'); } return $extracter->extract($file->getContents(), $startLine, $endLine); }