当前位置: 首页>>代码示例>>PHP>>正文


PHP ExecutableFinder::find方法代码示例

本文整理汇总了PHP中Symfony\Component\Process\ExecutableFinder::find方法的典型用法代码示例。如果您正苦于以下问题:PHP ExecutableFinder::find方法的具体用法?PHP ExecutableFinder::find怎么用?PHP ExecutableFinder::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Process\ExecutableFinder的用法示例。


在下文中一共展示了ExecutableFinder::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getConfigTreeBuilder

 /**
  * Generates the configuration tree builder.
  *
  * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder
  */
 public function getConfigTreeBuilder()
 {
     $builder = new TreeBuilder();
     $finder = new ExecutableFinder();
     $builder->root('assetic')->children()->booleanNode('debug')->defaultValue($this->debug)->end()->booleanNode('use_controller')->defaultValue($this->debug)->end()->scalarNode('read_from')->defaultValue('%kernel.root_dir%/../web')->end()->scalarNode('write_to')->defaultValue('%assetic.read_from%')->end()->scalarNode('java')->defaultValue($finder->find('java', '/usr/bin/java'))->end()->scalarNode('node')->defaultValue($finder->find('node', '/usr/bin/node'))->end()->scalarNode('sass')->defaultValue($finder->find('sass', '/usr/bin/sass'))->end()->end()->fixXmlConfig('bundle')->children()->arrayNode('bundles')->defaultValue($this->bundles)->requiresAtLeastOneElement()->prototype('scalar')->validate()->ifNotInArray($this->bundles)->thenInvalid('%s is not a valid bundle.')->end()->end()->end()->end()->fixXmlConfig('asset')->children()->arrayNode('assets')->addDefaultsIfNotSet()->requiresAtLeastOneElement()->useAttributeAsKey('name')->prototype('array')->beforeNormalization()->ifTrue(function ($v) {
         return !is_array($v);
     })->then(function ($v) {
         return array('inputs' => array($v));
     })->end()->beforeNormalization()->always()->then(function ($v) {
         // cast scalars as array
         foreach (array('input', 'inputs', 'filter', 'filters') as $key) {
             if (isset($v[$key]) && !is_array($v[$key])) {
                 $v[$key] = array($v[$key]);
             }
         }
         // organize arbitrary options
         foreach ($v as $key => $value) {
             if (!in_array($key, array('input', 'inputs', 'filter', 'filters', 'option', 'options'))) {
                 $v['options'][$key] = $value;
                 unset($v[$key]);
             }
         }
         return $v;
     })->end()->fixXmlConfig('input')->fixXmlConfig('filter')->children()->arrayNode('inputs')->prototype('scalar')->end()->end()->arrayNode('filters')->prototype('scalar')->end()->end()->arrayNode('options')->useAttributeAsKey('name')->prototype('variable')->end()->end()->end()->end()->end()->end()->fixXmlConfig('filter')->children()->arrayNode('filters')->addDefaultsIfNotSet()->requiresAtLeastOneElement()->useAttributeAsKey('name')->prototype('variable')->treatNullLike(array())->validate()->ifTrue(function ($v) {
         return !is_array($v);
     })->thenInvalid('The assetic.filters config %s must be either null or an array.')->end()->end()->end()->end()->children()->arrayNode('twig')->addDefaultsIfNotSet()->defaultValue(array())->fixXmlConfig('function')->children()->arrayNode('functions')->addDefaultsIfNotSet()->defaultValue(array())->useAttributeAsKey('name')->prototype('variable')->treatNullLike(array())->validate()->ifTrue(function ($v) {
         return !is_array($v);
     })->thenInvalid('The assetic.twig.functions config %s must be either null or an array.')->end()->end()->end()->end()->end()->end();
     return $builder;
 }
开发者ID:rfc1483,项目名称:blog,代码行数:35,代码来源:Configuration.php

示例2: __construct

 /**
  * Creates a new runner.
  *
  * @param string|null $binDir The path to Composer's "bin-dir".
  */
 public function __construct($binDir = null)
 {
     $phpFinder = new PhpExecutableFinder();
     if (!($php = $phpFinder->find())) {
         throw new RuntimeException('The "php" command could not be found.');
     }
     $puliFinder = new ExecutableFinder();
     // Search:
     // 1. in the current working directory
     // 2. in Composer's "bin-dir"
     // 3. in the system path
     $searchPath = array_merge(array(getcwd()), (array) $binDir);
     // Search "puli.phar" in the PATH and the current directory
     if (!($puli = $puliFinder->find('puli.phar', null, $searchPath))) {
         // Search "puli" in the PATH and Composer's "bin-dir"
         if (!($puli = $puliFinder->find('puli', null, $searchPath))) {
             throw new RuntimeException('The "puli"/"puli.phar" command could not be found.');
         }
     }
     if (Path::hasExtension($puli, '.bat', true)) {
         $this->puli = $puli;
     } else {
         $this->puli = $php . ' ' . $puli;
     }
 }
开发者ID:kormik,项目名称:composer-plugin,代码行数:30,代码来源:PuliRunner.php

示例3: find

 /**
  * @return string
  */
 public function find()
 {
     if (null === ($executable = $this->executableFinder->find('docker-compose'))) {
         throw new \RuntimeException('Unable to find docker-compose binary. ' . 'You should run `docker:install` to set up your Docker environment');
     }
     return $executable;
 }
开发者ID:Elfiggo,项目名称:dock-cli,代码行数:10,代码来源:ComposeExecutableFinder.php

示例4: find

 public static function find()
 {
     $composer = new ExecutableFinder();
     $composerPath = $composer->find('composer');
     if ($composerPath !== null) {
         return $composerPath;
     }
     $composerPath = $composer->find('composer.phar', null, [$this->baseDir, $this->baseDir . '/bin/']);
     if ($composerPath !== null) {
         return $composerPath;
     }
     throw new \RuntimeException('Cannot find a local installation of composer. Please ensure that composer is in your $PATH, or there is a composer.phar at the root of the symfony installation.');
 }
开发者ID:zsturgess,项目名称:herokuizemebundle,代码行数:13,代码来源:ComposerFinder.php

示例5: buildFixtures

 protected static function buildFixtures()
 {
     $finder = Finder::create();
     Filesystem::create()->copyDir(__DIR__ . '/fixtures', static::$tmpDir, $finder);
     chdir(static::$tmpDir);
     $exFinder = new ExecutableFinder();
     if (!is_executable($executable = $exFinder->find('composer.phar'))) {
         $executable = $exFinder->find('composer');
     }
     $process = new Process($executable . ' dumpautoload');
     $process->run();
     //static::$composerOutput = $process->getOutput();
 }
开发者ID:phpguard,项目名称:plugin-phpunit,代码行数:13,代码来源:TestCase.php

示例6: handle

 /**
  * {@inheritdoc}
  */
 public function handle()
 {
     if (!$this->processLauncher->isSupported()) {
         throw new RuntimeException('The ProcessLauncher must be supported for the man help to run.');
     }
     if (!$this->manBinary) {
         $this->manBinary = $this->executableFinder->find('man');
     }
     if (!$this->manBinary) {
         throw new RuntimeException('The "man" binary was not found.');
     }
     return $this->processLauncher->launchProcess(escapeshellcmd($this->manBinary) . ' -l %path%', array('path' => $this->path), false);
 }
开发者ID:webmozart,项目名称:console,代码行数:16,代码来源:HelpManHandler.php

示例7: handle

 /**
  * {@inheritdoc}
  */
 public function handle(Args $args, IO $io)
 {
     if ($this->processLauncher->isSupported()) {
         if (!$this->lessBinary) {
             $this->lessBinary = $this->executableFinder->find('less');
         }
         if ($this->lessBinary) {
             return $this->processLauncher->launchProcess(escapeshellcmd($this->lessBinary) . ' %path%', array('path' => $this->path), false);
         }
     }
     $io->write(file_get_contents($this->path));
     return 0;
 }
开发者ID:webmozart,项目名称:console,代码行数:16,代码来源:HelpAsciiDocHandler.php

示例8: locate

 /**
  * @param string $command
  * @param boolean $forceUnix This parameter makes it possible to force unix style commands
  *                           on a windows environment.
  *                           This can be useful in git hooks.
  *
  * @return string
  *
  * @throws RuntimeException if the command can not be found
  */
 public function locate($command, $forceUnix = false)
 {
     // Search executable:
     $executable = $this->executableFinder->find($command, null, array($this->binDir));
     if (!$executable) {
         throw new RuntimeException(sprintf('The executable for "%s" could not be found.', $command));
     }
     // Make sure to add unix-style directory separators if unix-mode is enforced
     if ($forceUnix) {
         $parts = pathinfo($executable);
         $executable = $parts['dirname'] . '/' . $parts['filename'];
     }
     return $executable;
 }
开发者ID:Big-Shark,项目名称:grumphp,代码行数:24,代码来源:ExternalCommand.php

示例9: __construct

 private $workbenchSettings;
 private $command;
 private $phpBinary;
 private $gitBinary;
 //private $pharSamiBinary;
 /**
  * WorkbenchApiGeneration constructor.
  * @param \Padosoft\Workbench\WorkbenchSettings $workbenchSettings
  * @param Command $command
  */
 public function __construct(WorkbenchSettings $workbenchSettings, Command $command)
 {
     $this->workbenchSettings = $workbenchSettings;
     $this->command = $command;
     $finder = new ExecutableFinder();
     $this->gitBinary = '"' . str_replace("\\", "/", $finder->find('git', null, [Config::get('workbench.git_path')])) . '"';
开发者ID:padosoft,项目名称:workbench,代码行数:16,代码来源:WorkbenchApiGeneration.php

示例10: execute

 public function execute(InputInterface $input, OutputInterface $output)
 {
     $this->output = $output;
     $outputDir = $input->getOption('outdir');
     $guiBin = null;
     if ($input->getOption('gui')) {
         $finder = new ExecutableFinder();
         $guiBin = $finder->find($input->getOption('gui-bin'));
         if (null === $guiBin) {
             throw new \InvalidArgumentException(sprintf('Could not locate GUI bin "%s"', $input->getOption('gui-bin')));
         }
     }
     if (!$this->filesystem->exists($outputDir)) {
         $output->writeln(sprintf('<comment>// creating non-existing directory %s</comment>', $outputDir));
         $this->filesystem->mkdir($outputDir);
     }
     $generatedFiles = array();
     $this->runnerHandler->runFromInput($input, $output, array('executor' => array('executor' => 'xdebug', 'output_dir' => $outputDir, 'callback' => function ($iteration) use($outputDir, $guiBin, &$generatedFiles) {
         $generatedFiles[] = $generatedFile = $outputDir . DIRECTORY_SEPARATOR . XDebugUtil::filenameFromIteration($iteration);
         if ($guiBin) {
             $process = new Process(sprintf($guiBin . ' ' . $generatedFile));
             $process->run();
         }
     }), 'iterations' => 1));
     $output->write(PHP_EOL);
     $output->writeln(sprintf('<info>%s profile(s) generated:</info>', count($generatedFiles)));
     $output->write(PHP_EOL);
     foreach ($generatedFiles as $generatedFile) {
         if (!file_exists($generatedFile)) {
             throw new \InvalidArgumentException(sprintf('Profile "%s" was not generated. Maybe you do not have XDebug installed?', $generatedFile));
         }
         $this->output->writeln(sprintf('    %s', $generatedFile));
     }
 }
开发者ID:Remo,项目名称:phpbench,代码行数:34,代码来源:ProfileCommand.php

示例11: findExecutable

 public function findExecutable($name, $default = null, array $extraDirs = array())
 {
     $finder = new ExecutableFinder();
     $extraDirs = array_merge($this->getDefaultDirs(), $extraDirs);
     $executable = $finder->find($name, $default, $extraDirs);
     return is_executable($executable) ? $executable : false;
 }
开发者ID:phpguard,项目名称:phpguard,代码行数:7,代码来源:Runner.php

示例12: render

 function render($context = null, $vars = array())
 {
     $options = $this->options;
     $compress = @$options["compress"] ?: false;
     $outputFile = tempnam(sys_get_temp_dir(), 'metatemplate_template_less_output');
     $finder = new ExecutableFinder();
     $bin = @$this->options["less_bin"] ?: self::DEFAULT_LESSC;
     $cmd = $finder->find($bin);
     if ($cmd === null) {
         throw new \UnexpectedValueException("'{$bin}' executable was not found. Make sure it's installed.");
     }
     if ($compress) {
         $cmd .= ' -x';
     }
     if (array_key_exists('include_path', $this->options)) {
         $cmd .= sprintf('--include-path %s', escapeshellarg(join(PATH_SEPARATOR, (array) $this->options['include_path'])));
     }
     $cmd .= " --no-color - {$outputFile}";
     $process = new Process($cmd);
     $process->setStdin($this->getData());
     if ($this->isFile()) {
         $process->setWorkingDirectory(dirname($this->source));
     }
     $process->setEnv(array('PATH' => getenv("PATH")));
     $process->run();
     $content = @file_get_contents($outputFile);
     @unlink($outputFile);
     if (!$process->isSuccessful()) {
         throw new \RuntimeException("{$cmd} returned an error: " . $process->getErrorOutput());
     }
     return $content;
 }
开发者ID:chh,项目名称:meta-template,代码行数:32,代码来源:LessTemplate.php

示例13: NotifySendNotification

 /**
  * @param \Symfony\Component\Process\ExecutableFinder $finder
  */
 function it_should_handle_notifysend_notifications_only($finder)
 {
     $notification = new NotifySendNotification('message', []);
     $otherNotification = new EmailNotification(['recipient'], []);
     $finder->find(NotifySend::NOTIFY_SEND_COMMAND)->willReturn(true);
     if (!$this->getWrappedObject()->shouldHandle($notification)) {
         throw new \Exception('fails');
     }
     if ($this->getWrappedObject()->shouldHandle($otherNotification)) {
         throw new \Exception('fails');
     }
     $finder->find(NotifySend::NOTIFY_SEND_COMMAND)->willReturn(null);
     if ($this->getWrappedObject()->shouldHandle($notification)) {
         throw new \Exception('fails');
     }
 }
开发者ID:namshi,项目名称:notificator,代码行数:19,代码来源:NotifySendSpec.php

示例14: testConfiguredUsage

 public function testConfiguredUsage()
 {
     $executableFinder = new ExecutableFinder();
     $php = $executableFinder->find('php');
     if (null === $php) {
         $this->markTestSkipped('Unable to find mandatory PHP executable');
     }
     $app = new Application();
     $app->register(new MediaAlchemystServiceProvider(), array('media-alchemyst.configuration' => array('ffmpeg.threads' => 42, 'ffmpeg.ffmpeg.timeout' => 42, 'ffmpeg.ffprobe.timeout' => 42, 'ffmpeg.ffmpeg.binaries' => $php, 'ffmpeg.ffprobe.binaries' => $php, 'imagine.driver' => 'gd', 'gs.timeout' => 42, 'gs.binaries' => $php, 'mp4box.timeout' => 42, 'mp4box.binaries' => $php, 'swftools.timeout' => 42, 'swftools.pdf2swf.binaries' => $php, 'swftools.swfrender.binaries' => $php, 'swftools.swfextract.binaries' => $php, 'unoconv.binaries' => $php, 'unoconv.timeout' => 42)));
     $drivers = $app['media-alchemyst']->getDrivers();
     $this->assertEquals($php, $drivers['ffmpeg.ffmpeg']->getFFMpegDriver()->getProcessBuilderFactory()->getBinary());
     $this->assertEquals($php, $drivers['ffmpeg.ffprobe']->getFFProbeDriver()->getProcessBuilderFactory()->getBinary());
     $this->assertEquals($php, $drivers['ghostscript.transcoder']->getProcessBuilderFactory()->getBinary());
     $this->assertInstanceOf('Imagine\\Gd\\Imagine', $drivers['imagine']);
     $this->assertEquals($php, $drivers['swftools.driver-container']['pdf2swf']->getProcessBuilderFactory()->getBinary());
     $this->assertEquals($php, $drivers['swftools.driver-container']['swfextract']->getProcessBuilderFactory()->getBinary());
     $this->assertEquals($php, $drivers['swftools.driver-container']['swfrender']->getProcessBuilderFactory()->getBinary());
     $this->assertEquals($php, $drivers['unoconv']->getProcessBuilderFactory()->getBinary());
     $this->assertEquals($php, $drivers['mp4box']->getProcessBuilderFactory()->getBinary());
     $this->assertEquals(42, $drivers['ffmpeg.ffmpeg']->getFFMpegDriver()->getConfiguration()->get('ffmpeg.threads'));
     $this->assertEquals(42, $drivers['ffmpeg.ffmpeg']->getFFMpegDriver()->getProcessBuilderFactory()->getTimeout());
     $this->assertEquals(42, $drivers['ffmpeg.ffprobe']->getFFProbeDriver()->getProcessBuilderFactory()->getTimeout());
     $this->assertEquals(42, $drivers['ghostscript.transcoder']->getProcessBuilderFactory()->getTimeout());
     $this->assertEquals(42, $drivers['swftools.driver-container']['pdf2swf']->getProcessBuilderFactory()->getTimeout());
     $this->assertEquals(42, $drivers['swftools.driver-container']['swfextract']->getProcessBuilderFactory()->getTimeout());
     $this->assertEquals(42, $drivers['swftools.driver-container']['swfrender']->getProcessBuilderFactory()->getTimeout());
     $this->assertEquals(42, $drivers['unoconv']->getProcessBuilderFactory()->getTimeout());
     $this->assertEquals(42, $drivers['mp4box']->getProcessBuilderFactory()->getTimeout());
 }
开发者ID:bburnichon,项目名称:Media-Alchemyst,代码行数:29,代码来源:MediaAlchemystServiceProviderTest.php

示例15: testCustomizedDrivers

 public function testCustomizedDrivers()
 {
     $object = new DriversContainer();
     $executableFinder = new ExecutableFinder();
     $php = $executableFinder->find('php');
     if (null === $php) {
         $this->markTestSkipped('Unable to find mandatory PHP executable');
     }
     $object['configuration'] = array('ffmpeg.threads' => 42, 'ffmpeg.ffmpeg.timeout' => 42, 'ffmpeg.ffprobe.timeout' => 42, 'ffmpeg.ffmpeg.binaries' => $php, 'ffmpeg.ffprobe.binaries' => $php, 'imagine.driver' => 'gd', 'gs.timeout' => 42, 'gs.binaries' => $php, 'mp4box.timeout' => 42, 'mp4box.binaries' => $php, 'swftools.timeout' => 42, 'swftools.pdf2swf.binaries' => $php, 'swftools.swfrender.binaries' => $php, 'swftools.swfextract.binaries' => $php, 'unoconv.binaries' => $php, 'unoconv.timeout' => 42);
     $this->assertEquals($php, $object['ffmpeg.ffmpeg']->getFFMpegDriver()->getProcessBuilderFactory()->getBinary());
     $this->assertEquals($php, $object['ffmpeg.ffprobe']->getFFProbeDriver()->getProcessBuilderFactory()->getBinary());
     $this->assertEquals($php, $object['ghostscript.transcoder']->getProcessBuilderFactory()->getBinary());
     $this->assertInstanceOf('Imagine\\Gd\\Imagine', $object['imagine']);
     $this->assertEquals($php, $object['swftools.driver-container']['pdf2swf']->getProcessBuilderFactory()->getBinary());
     $this->assertEquals($php, $object['swftools.driver-container']['swfextract']->getProcessBuilderFactory()->getBinary());
     $this->assertEquals($php, $object['swftools.driver-container']['swfrender']->getProcessBuilderFactory()->getBinary());
     $this->assertEquals($php, $object['unoconv']->getProcessBuilderFactory()->getBinary());
     $this->assertEquals($php, $object['mp4box']->getProcessBuilderFactory()->getBinary());
     $this->assertEquals(42, $object['ffmpeg.ffmpeg']->getFFMpegDriver()->getConfiguration()->get('ffmpeg.threads'));
     $this->assertEquals(42, $object['ffmpeg.ffmpeg']->getFFMpegDriver()->getProcessBuilderFactory()->getTimeout());
     $this->assertEquals(42, $object['ffmpeg.ffprobe']->getFFProbeDriver()->getProcessBuilderFactory()->getTimeout());
     $this->assertEquals(42, $object['ghostscript.transcoder']->getProcessBuilderFactory()->getTimeout());
     $this->assertEquals(42, $object['swftools.driver-container']['pdf2swf']->getProcessBuilderFactory()->getTimeout());
     $this->assertEquals(42, $object['swftools.driver-container']['swfextract']->getProcessBuilderFactory()->getTimeout());
     $this->assertEquals(42, $object['swftools.driver-container']['swfrender']->getProcessBuilderFactory()->getTimeout());
     $this->assertEquals(42, $object['unoconv']->getProcessBuilderFactory()->getTimeout());
     $this->assertEquals(42, $object['mp4box']->getProcessBuilderFactory()->getTimeout());
 }
开发者ID:bburnichon,项目名称:Media-Alchemyst,代码行数:28,代码来源:DriversContainersTest.php


注:本文中的Symfony\Component\Process\ExecutableFinder::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。