Пример #1
0
 /**
  * Parses the given token reader
  *
  * @param \r8\FileSys\File $path The file to parse
  * @return \vc\Data\File
  */
 public function parse(\r8\FileSys\File $path)
 {
     $file = new \vc\Data\File($path->getPath());
     $tokens = \vc\Tokens\Access::buildAccess(new \vc\Tokens\Parser(new \r8\Stream\In\File($path)));
     $this->comment->parse($file, $tokens);
     return $file;
 }
Пример #2
0
 /**
  * Constructor...
  *
  * @param \r8\FileSys\File $file The file being opened
  */
 public function __construct(\r8\FileSys\File $file)
 {
     $file->requirePath();
     if (!$file->isReadable()) {
         throw new \r8\Exception\FileSystem\Permissions($file->getPath(), "File is not readable");
     }
     parent::__construct($file->getPath());
 }
Пример #3
0
 /**
  * Returns the file requested by the client, in the context of the file system
  *
  * @return \r8\FileSys\File
  */
 public function getFile()
 {
     if (!isset($this->file)) {
         $this->file = new \r8\FileSys\File();
         if (self::hasKey($this->server, 'SCRIPT_FILENAME')) {
             $this->file->setPath($this->server['SCRIPT_FILENAME']);
         }
     }
     return clone $this->file;
 }
Пример #4
0
 /**
  * Returns whether this file is readable
  *
  * @return Boolean
  */
 public function isReadable()
 {
     return $this->file->isReadable();
 }
Пример #5
0
 /**
  * Logs that a file could not be parsed
  *
  * @param \r8\FileSys\File $file The file that was parsed
  * @param \vc\Tokens\Exception $err The error that occurred
  * @return NULL
  */
 public function errorParsingFile(\r8\FileSys\File $file, \vc\Tokens\Exception $err)
 {
     $this->log->warning(sprintf('Unable to parse file (%s) becase of error: %s', $file->getPath(), $err->getMessage()), 'PARSE_ERR');
 }