addErrorOutput() public method

Adds a line to the STDERR stream.
public addErrorOutput ( string $line )
$line string The line to append
 public function __construct()
 {
     // parsing cron file
     $process = new Process('crontab -l');
     $process->run();
     $lines = array_filter(explode(PHP_EOL, $process->getOutput()), function ($line) {
         return '' != trim($line);
     });
     foreach ($lines as $lineNumber => $line) {
         // if line is nt a comment, convert it to a cron
         if (strpos($line, '#suspended: ', 0) === 0 || 0 !== strpos($line, '#', 0)) {
             try {
                 $line = Cron::parse($line);
             } catch (\Exception $e) {
                 $process->addErrorOutput('CronManager was unable to parse crontab at line ' . $lineNumber);
             }
         }
         $this->lines['l' . $lineNumber] = $line;
     }
     $this->error = $process->getErrorOutput();
 }
示例#2
0
 public function addErrorOutput($line)
 {
     parent::addErrorOutput($line);
     $this->consoleOutput .= $line;
 }