Pickle\Engine::factory PHP Method

factory() public static method

public static factory ( $phpcli = NULL )
    public static function factory($phpcli = NULL)
    {
        if (null == self::$instance) {
            if (!$phpcli) {
                $phpcli = PHP_BINARY;
            }
            if (defined('HHVM_VERSION')) {
                /* This needs to be checked first, PHP_VERSION is
                   defined in HHVM. */
                self::$instance = new HHVM($phpcli);
            } else {
                /* We don't support anything else, so this has to
                   be classic PHP right now. This could change
                   if other PHP implementations are supported. */
                self::$instance = new PHP($phpcli);
            }
        }
        return self::$instance;
    }

Usage Example

コード例 #1
0
ファイル: InstallerCommand.php プロジェクト: jingdor/pickle
 /**
  * @param string          $path
  * @param InputInterface  $input
  * @param OutputInterface $output
  */
 protected function binaryInstallWindows($path, InputInterface $input, OutputInterface $output)
 {
     $php = Engine::factory();
     $table = new Table($output);
     $table->setRows([['<info>' . $php->getName() . ' Path</info>', $php->getPath()], ['<info>' . $php->getName() . ' Version</info>', $php->getVersion()], ['<info>Compiler</info>', $php->getCompiler()], ['<info>Architecture</info>', $php->getArchitecture()], ['<info>Thread safety</info>', $php->getZts() ? 'yes' : 'no'], ['<info>Extension dir</info>', $php->getExtensionDir()], ['<info>php.ini</info>', $php->getIniPath()]])->render();
     $inst = Install::factory($path);
     $progress = $this->getHelperSet()->get('progress');
     $inst->setProgress($progress);
     $inst->setInput($input);
     $inst->setOutput($output);
     $inst->install();
     $deps_handler = new Windows\DependencyLib($php);
     $deps_handler->setProgress($progress);
     $deps_handler->setInput($input);
     $deps_handler->setOutput($output);
     $helper = $this->getHelperSet()->get('question');
     $cb = function ($choices) use($helper, $input, $output) {
         $question = new ChoiceQuestion('Multiple choices found, please select the appropriate dependency package', $choices);
         $question->setMultiselect(false);
         return $helper->ask($input, $output, $question);
     };
     foreach ($inst->getExtDllPaths() as $dll) {
         if (!$deps_handler->resolveForBin($dll, $cb)) {
             throw new \Exception('Failed to resolve dependencies');
         }
     }
 }
All Usage Examples Of Pickle\Engine::factory
Engine