Exemple #1
0
Fichier : File.php Projet : jasny/Q
 /**
  * Class constructor.
  * 
  * @param string $path
  */
 public function __construct($path)
 {
     parent::__construct($path);
     if (file_exists($path) && !is_file($path)) {
         throw new Fs_Exception("File '{$path}' is not a regular file, but a " . Fs::typeOfNode($path, Fs::DESCRIPTION));
     }
     if (is_link($path) xor $this instanceof Fs_Symlink) {
         throw new Fs_Exception("File '{$path}' is " . ($this instanceof Fs_Symlink ? 'not ' : '') . "a symlink");
     }
 }
Exemple #2
0
 /**
  * Class constructor.
  * 
  * @param string $path
  */
 public function __construct($path)
 {
     parent::__construct($path);
     if (file_exists($path) && filetype(realpath($path)) != 'unknown') {
         throw new Fs_Exception("File '{$path}' is not a file with an unknown type, but a " . Fs::typeOfNode($path, Fs::DESCRIPTION));
     }
     if (is_link($path) xor $this instanceof Fs_Symlink) {
         throw new Fs_Exception("File '{$path}' is " . ($this instanceof Fs_Symlink ? 'not ' : '') . "a symlink.");
     }
 }
Exemple #3
0
Fichier : Node.php Projet : jasny/Q
 /**
  * Execute file and return content of stdout.
  * 
  * @param Parameters will be escaped and passed as arguments.
  * @return string
  * @throws Fs_Exception if execution is not possible.
  * @throws ExecException if execution fails.
  */
 public function exec()
 {
     throw new Fs_Exception("Unable to execute '{$this->_path}': This is not a regular file, but a " . Fs::typeOfNode($this, Fs::DESCRIPTION));
 }