Beispiel #1
0
 public function setToView($nameOrData, $value = null)
 {
     parent::setToView($nameOrData, $value);
 }
 /**
  * Parses the switches used by the script.
  *
  * @param array $switches   The parsed switches.
  *
  * @return bool   Returns TRUE, if the validation of the provided switches was successful.
  *
  * @throws \YapepBase\Exception\ParameterException   If there are errors regarding the PID file
  */
 protected function parseSwitches(array $switches)
 {
     parent::parseSwitches($switches);
     $config = Config::getInstance();
     $this->pidPath = empty($switches['pid-path']) ? $config->get('system.path.batchPid', '/var/run') : $switches['pid-path'];
     $this->pidFile = empty($switches['pid-file']) ? preg_replace('/\\.php$/', '', basename($_SERVER['argv'][0])) . '.pid' : $switches['pid-file'];
     if (!is_dir($this->pidPath)) {
         throw new ParameterException('The pid path does not exist: ' . $this->pidPath);
     }
     if (!is_writable($this->pidPath) || file_exists($this->getFullPidFile()) && !is_writable($this->getFullPidFile())) {
         throw new ParameterException('The pid file is not writable: ' . $this->getFullPidFile());
     }
 }