/** * 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; }
/** * 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; }
protected function is_file_templated($source, $target) { return $this->is_extension_templated(\AbstractFile::extension_for($target)); }
/** * 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; } }
/** * 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(); }
/** * @return boolean */ public function delete() { if ($this->isUnchanged()) { return FALSE; } return parent::delete(); }
/** * 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); }