has() public method

Determines whether a service is defined
public has ( string $id ) : boolean
$id string
return boolean
Example #1
0
 /**
  * @param IndexedServiceContainer $container
  */
 private function setupRerunner(IndexedServiceContainer $container)
 {
     $container->define('process.rerunner', function (IndexedServiceContainer $c) {
         return new ReRunner\OptionalReRunner($c->get('process.rerunner.platformspecific'), $c->get('console.io'));
     });
     if ($container->has('process.rerunner.platformspecific')) {
         return;
     }
     $container->define('process.rerunner.platformspecific', function (IndexedServiceContainer $c) {
         return new ReRunner\CompositeReRunner($c->getByTag('process.rerunner.platformspecific'));
     });
     $container->define('process.rerunner.platformspecific.pcntl', function (IndexedServiceContainer $c) {
         return ReRunner\PcntlReRunner::withExecutionContext($c->get('process.phpexecutablefinder'), $c->get('process.executioncontext'));
     }, ['process.rerunner.platformspecific']);
     $container->define('process.rerunner.platformspecific.passthru', function (IndexedServiceContainer $c) {
         return ReRunner\ProcOpenReRunner::withExecutionContext($c->get('process.phpexecutablefinder'), $c->get('process.executioncontext'));
     }, ['process.rerunner.platformspecific']);
     $container->define('process.rerunner.platformspecific.windowspassthru', function (IndexedServiceContainer $c) {
         return ReRunner\WindowsPassthruReRunner::withExecutionContext($c->get('process.phpexecutablefinder'), $c->get('process.executioncontext'));
     }, ['process.rerunner.platformspecific']);
     $container->define('process.phpexecutablefinder', function () {
         return new PhpExecutableFinder();
     });
 }