Jobby\Helper::escape PHP Метод

escape() публичный Метод

public escape ( string $input ) : string
$input string
Результат string
    public function escape($input)
    {
        $input = strtolower($input);
        $input = preg_replace('/[^a-z0-9_. -]+/', '', $input);
        $input = trim($input);
        $input = str_replace(' ', '_', $input);
        $input = preg_replace('/_{2,}/', '_', $input);
        return $input;
    }

Usage Example

Пример #1
0
 /**
  * @return string
  */
 protected function getLockFile()
 {
     $tmp = $this->tmpDir;
     $job = $this->helper->escape($this->job);
     if (!empty($this->config['environment'])) {
         $env = $this->helper->escape($this->config['environment']);
         return "{$tmp}/{$env}-{$job}.lck";
     } else {
         return "{$tmp}/{$job}.lck";
     }
 }
All Usage Examples Of Jobby\Helper::escape