/** * {@inheritdoc} */ public function validate() { $path = Path::normalize($this->value); $test = $this->isDir === true ? Dir::isWritable($path) : File::isWritable($path); if ($test === true) { $this->value = $path; return true; } $this->message = $test; return false; }
/** * Set an output file for either stdout or stderr * * @param integer $stream The index of the relevant stream * @param string $path An absolute file path * @param boolean $append Whether or not to append to the file */ private function setOutputFile($stream, $path, $append) { if (($test = File::isWritable($path)) !== true) { throw new InvalidArgumentException("invalid value provided for 'path'; {$test}"); } $this->spec[$stream] = ['file', $path, $append === true ? 'a' : 'w']; }