Mutagenesis\Utility\Process::run PHP Метод

run() публичный статический Метод

Opens a new process to execute PHP on the source code passed to the method. If you're looking for how this process can be timed out - check the Utility/Job class which sets it internally in the source code to be executed.
public static run ( string $source )
$source string
    public static function run($source)
    {
        $process = proc_open(self::_getPhpBinary(), self::$_descriptorSpec, $pipes);
        if (is_resource($process)) {
            fwrite($pipes[0], $source);
            fclose($pipes[0]);
            $stdout = stream_get_contents($pipes[1]);
            fclose($pipes[1]);
            $stderr = stream_get_contents($pipes[2]);
            fclose($pipes[2]);
            proc_close($process);
            $return = array('stdout' => $stdout, 'stderr' => $stderr);
            return $return;
        } else {
            throw new \Mutagenesis\FUTException('Unable to open a new process');
        }
    }

Usage Example

Пример #1
0
 /**
  * Execute the generated job which is to call the static main method.
  *
  * @param string $jobScript
  * @return string $output
  */
 public static function execute($jobScript)
 {
     $output = \Mutagenesis\Utility\Process::run($jobScript);
     return $output;
 }
All Usage Examples Of Mutagenesis\Utility\Process::run