Exemplo n.º 1
0
 /**
  * be CAREFUL using this function since if the file is large
  * loading he whole file into memory could immediately cause
  * you to run out of memory. This has been made available to the developer
  * if they want to use it but it seems it would usually not be a good idea.
  * If you want to go over each line and do something then using iteration
  * would probably be better since only one or 2 lines are usually in memory
  * at a time
  *
  * @return string
  */
 public function __toString()
 {
     $string = parent::__toString();
     if ($this->hasTrailingLineSeparator) {
         $string .= $this->lineSeparator;
     }
     return $string;
 }
Exemplo n.º 2
0
 /**
  * Constructor
  * @param string $name
  * @param string $absolutePath
  */
 public function __construct($name, $absolutePath)
 {
     parent::__construct($name);
     if (!($this->absolutePath = \realpath($absolutePath)) or !\is_readable($this->absolutePath)) {
         throw new \Foundation\Exception("Unable to read '{$absolutePath}'.");
     }
     $this->fileContents = false;
 }
Exemplo n.º 3
0
 protected function is_file_templated($source, $target)
 {
     return $this->is_extension_templated(\AbstractFile::extension_for($target));
 }
Exemplo n.º 4
0
 /**
  * Delete processed file
  *
  * @param bool $force
  * @return bool
  */
 public function delete($force = false)
 {
     if (!$force && $this->isUnchanged()) {
         return false;
     }
     // Only delete file when original isn't used
     if (!$this->usesOriginalFile()) {
         return parent::delete();
     } else {
         return true;
     }
 }
Exemplo n.º 5
0
 /**
  * Delete processed file
  *
  * @param boolean $force
  * @return boolean
  */
 public function delete($force = FALSE)
 {
     if (!$force && $this->isUnchanged()) {
         return FALSE;
     }
     return parent::delete();
 }
 /**
  * Create a new instance.
  *
  * @param AbstractFile $file The Xliff file we are working on.
  */
 public function __construct(AbstractFile $file)
 {
     $this->position = 0;
     $this->file = $file;
     $this->keys = $file->getKeys();
 }
Exemplo n.º 7
0
 /**
  * @return boolean
  */
 public function delete()
 {
     if ($this->isUnchanged()) {
         return FALSE;
     }
     return parent::delete();
 }
Exemplo n.º 8
0
 /**
  * Constructor
  * @param string $name
  * @param string $fileContents
  * @param string $lastModified
  */
 public function __construct($name, $fileContents, $lastModified = 'now')
 {
     parent::__construct($name);
     $this->fileContents = $fileContents;
     $this->lastModified = new \DateTime($lastModified);
 }