Example #1
0
 /**
  * @return mixed The content of the file or FALSE if an error occured
  */
 public function getContents()
 {
     $this->destroyConnection();
     return parent::getContents();
 }
Example #2
0
 /**
  * Constructor
  *
  * @throws \BLW\Model\InvalidArgumentException
  *            If:
  *
  * <ul>
  * <li><code>$BuildPath</code> Is not a writable directory.</li>
  * <li><code>$RootPath</code> Is not a readable directory.</li>
  * <li><code>$TempPath</code> Is not a writable directory.</li>
  * </ul>
  *
  * @param \BLW\Type\IFile $BuildPath
  *            Directory to store compiled resouces.
  * @param \BLW\Type\IFile $RootPath
  *            [optional] Base path of compiler. <code>NULL</code> for current directory.
  * @param \BLW\Type\IFile $TempPath
  *            [optional] Directory to store temporary files. <code>NULL</code> for sys_get_temp_dir().
  * @param \BLW\Type\IMediator $Mediator
  *            [optional] Mediator for compiler.
  */
 public function __construct(IFile $BuildPath, IFile $RootPath = null, IFile $TempPath = null, IMediator $Mediator = null)
 {
     // Is $RootPath null?
     if (!$RootPath) {
         // Default
         $RootPath = new GenericFile(getcwd());
     }
     // Is $TempPath null
     if (!$TempPath) {
         $TempPath = new GenericFile(sys_get_temp_dir());
     }
     // Is $BuildPath a writable?
     if (!$BuildPath->isWritable()) {
         throw new InvalidArgumentException(0, '%header% $BuildPath is not writable');
         /// Is $BuildPath a directory
     } elseif (!$BuildPath->isDir()) {
         throw new InvalidArgumentException(0, '%header% $BuildPath is not a directory');
         // Is $RootPath a readable?
     } elseif (!$RootPath->isReadable()) {
         throw new InvalidArgumentException(1, '%header% $RootPath is not readable');
         /// Is $RootPath a directory
     } elseif (!$RootPath->isDir()) {
         throw new InvalidArgumentException(1, '%header% $RootPath is not a directory');
         // Is $TempPath writable
     } elseif (!$TempPath->isWritable()) {
         throw new InvalidArgumentException(2, '%header% $TempPath is not writable');
         // Is $TempPath a directory
     } elseif (!$TempPath->isDir()) {
         throw new InvalidArgumentException(2, '%header% $TempPath is not a directory');
     } else {
         // Properties
         $this->_DataMapper = new ArrayObject();
         $this->_ID = 'Compiler';
         $this->_Temp = $TempPath;
         $this->_Build = $BuildPath;
         $this->_Root = $RootPath;
         $this->_Files = array();
         // Mediator
         if ($Mediator) {
             $this->setMediator($Mediator);
         }
     }
 }