/** * Returns the target or the default. * * @return string */ public function getTarget() { $target = parent::getTarget(); $target = $target === null ? trim(DocBlox_Core_Abstract::config()->transformer->target) : trim($target); // if the folder does not exist at all, create it if (!file_exists($target)) { mkdir($target, 0744, true); } if ($target == '' || $target == DIRECTORY_SEPARATOR) { throw new Zend_Console_Getopt_Exception('Either an empty path or root was given: ' . $target); } if (!is_dir($target)) { throw new Zend_Console_Getopt_Exception('The given location "' . $target . '" is not a folder.'); } if (!is_writable($target)) { throw new Zend_Console_Getopt_Exception('The given path "' . $target . '" either does not exist or is not writable.'); } return realpath($target); }