Build the Chromedriver with Symfony Process.

@param  array  $arguments
@return \Symfony\Component\Process\Process
175568
protected function process(array $arguments = [])
    {
        return new Process(
            array_merge([realpath($this->driver)], $arguments), null, $this->chromeEnvironment()
        );
    }
757479
private function createDispatch(array $arguments)
    {
        $arguments['controller'] = $this->filterName($arguments['controller']);
        $data = [
            'className' => ltrim(
                "{$arguments['namespace']}"."\\"."{$arguments['controller']}",
                "\\"
            ),
            'method' => lcfirst($this->filterName($arguments['action'])),
            'arguments' => $arguments['args']
        ];
        $reflection = new \ReflectionClass(ControllerDispatch::class);
        return $reflection->newInstanceArgs($data);
    }
401409
protected function createInputFromArguments(array $arguments)
    {
        return tap(
            new ArrayInput($arguments), function ($input) {
                if ($input->hasParameterOption(['--no-interaction'], true)) {
                    $input->setInteractive(false);
                }
            }
        );
    }
156495
public function newDefaultAnnotationDriver(array $paths = []) : AnnotationDriver
    {
        AnnotationRegistry::registerFile(__DIR__ . '/Annotation/DoctrineAnnotations.php');

        $reader = new CachedReader(new AnnotationReader(), new ArrayCache());

        return new AnnotationDriver($reader, $paths);
    }
86196
public function start()
    {
        $cmd = $this->command->getPreparedCommand();
        $cwd = realpath(CRAFT_BASE_PATH);

        $process = Process::fromShellCommandline($cmd, $cwd);

        try {
            $process->run();
        } catch (\Symfony\Component\Process\Exception\RuntimeException $e) {
            $e = new RuntimeException($e->getMessage());
            $e->setProcess($process);
            throw $e;
        } catch (\Symfony\Component\Process\Exception\LogicException $e) {
            $e = new LogicException($e->getMessage());
            $e->setProcess($process);
            throw $e;
        }

        return $process;
    }
225921
public function launch(ContextInterface $ctx, ...$args): ProcessInstance
	{
		if ($this->executable) {
			$executable = $this->executable;

		} else if (PHP_OS === "Linux") {
			$finder = new ExecutableFinder();
			$executable = $finder->find(static::DEFAULT_LINUX_EXECUTABLE);
			if ($executable === null) {
				throw new RuntimeException(sprintf("Executable [%s] not found.", static::DEFAULT_LINUX_EXECUTABLE));
			}

		} else if (strncasecmp(PHP_OS, "Win", 3) === 0) {
			$finder = new ExecutableFinder();
			$executable = $finder->find(static::DEFAULT_WINDOWS_EXECUTABLE);
			if ($executable === null) {
				throw new RuntimeException(sprintf("Executable [%s] not found.", static::DEFAULT_WINDOWS_EXECUTABLE));
			}

		} else if (PHP_OS === "Darwin") {
			$candidateExecutables = [
				// Chrome Canary
				"/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary",
				// Chrome Stable
				"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
			];

			$executable = null;
			foreach ($candidateExecutables as $candidateExecutable) {
				if (is_executable($candidateExecutable)) {
					$executable = $candidateExecutable;
					break;
				}
			}

			if ($executable === null) {
				throw new RuntimeException(sprintf("No OS X executable found."));
			}

		} else {
			throw new LogicException(sprintf("Operating system [%s] not supported.", PHP_OS));
		}

		return $this->launchWithExecutable($ctx, $executable, ...$args);
	}
1305798
public function render(array $arguments = [], $renderer = null) {
        $this->runDynamicCallbacks($arguments);

        return $this->baseRender($arguments, $renderer);
    }
511820
public function run($run, array $arguments = [])
    {

        $lambda = new Lambda($run);

        return $this->repository->transaction(function($repo) use ($lambda, $arguments) {

            $taskTemplate = $this->newTask($lambda);

            $this->callBeforeListeners('run', [$taskTemplate, $lambda, $arguments]);

            $task = $this->repository->create($taskTemplate);

            $job = $this->createJob($task, $lambda, $arguments);

            // We can just ignore to write state because typically the job
            // is typically started in another process
            $task->setJob($job);

            $this->callAfterListeners('run', [$taskTemplate, $job]);

            return $task;

        });
    }
861335
protected function execute(array $arguments)
    {
        \array_unshift($arguments, $this->path);
        
        $builder = ProcessBuilder::create($arguments);
        $process = $builder->getProcess();
        $process->run();
        
        if (!$process->isSuccessful()) {
            throw CommandException::factory($process);
        }
        
        // E.g. tesseract --version returns output as error output
        return $process->getOutput() ? $process->getOutput() : $process->getErrorOutput();
    }
1064790
public static function make(array $arguments = [])
    {
        $class = static::getFacadeAccessor();

        try {
            $reflection = new \ReflectionClass(static::getFacadeAccessor());
            $parameters = $reflection->getConstructor()->getParameters();
        } catch (\Throwable $error) {
            throw new \Exception('Wrong parameter', 0, $error);
        }

        return new $class(...static::composeMakeParameters($parameters, $arguments));
    }
1201988
public function executeCommand(array $arguments, $processBuilderCallback = null)
    {
        $processBuilder = clone $this->processBuilder;
        $processBuilder->setArguments($arguments);

        if (is_callable($processBuilderCallback)) {
            $processBuilderCallback($processBuilder);
        }

        $process = $processBuilder->getProcess();
        $process->run();

        if (!$process->isSuccessful()) {
            if (127 === $process->getExitCode()) {
                throw new ExecutableNotFoundException($process);
            }

            throw new ProcessFailedException($process);
        }

        return $process;
    }
1195711
protected function createLaravelAdapter(array $args=[])
    {
        if(!$this->app->bound('filedb.filesystem')) {
            return new FilesystemAdapter($this->createFlysystem($args));
        }

        $adapter = $this->app->make('filedb.filesystem');

        if ($adapter instanceof \Illuminate\Contracts\Filesystem\Filesystem) {
            return $adapter;
        }

        throw new TypeException("The binding behind filedb.filesystem implement Filesystem interface not " . Type::of($adapter));

    }
792783
public function addArguments(array $arguments)
    {
        foreach ($arguments as $param => $value) {
            $this->addArgument($param, $value);
        }

        return $this;
    }
393547
public function run($parameters = array()) {

        // Grab a process ID for a new forked process
        $this->pid = \pcntl_fork();

        if (!$this->pid) {
            $this->process($parameters);
            posix_kill(getmypid(), 9);
        }

        return $this->pid;
    }
559209
protected function mapArguments(array $arguments)
    {
        $keys = isset($this->mappableArguments[$this->element()]) ? $this->mappableArguments[$this->element()] : [];

        return array_combine(array_slice($keys, 0, count($arguments)), $arguments);
    }
689422
protected function processArgument(Element $arg) {
		// Value of the special types:
		if (isset($arg->type)) {
			$type = strtolower(trim($arg->type));
			
			switch ($type) {
				case 'bool':
				case 'boolean':
					return $this->processArgumentBoolean($arg);
					
				case 'service':
					return $this->processArgumentService($arg);
					
				case 'parameter':
					return $this->processArgumentParameter($arg);
					
				case 'null':
					return $this->processArgumentNull($arg);
					
				case 'array':
					return $this->processArgumentArray($arg);
			}
			
			throw new InvalidConfig('Invalid type of argument: "' . $type . '"', null, null, $arg);
		}
		
		// Scalar value: string, int, float
		$definition = new stdClass();
		
		if (isset($arg->value)) {
			$definition->type  = 'value';
			$definition->value = Std::parseValue($arg->value);
			
			return $definition;
		}
		
		$value = $arg->getValue();
		
		if (! empty($value)) {
			$definition->type  = 'value';
			$definition->value = Std::parseValue($value);
			
			return $definition;
		}
		
		throw new InvalidConfig('Invalid definition of argument', null, null, $arg);
	}
122363
public function add(...$arguments): QueryBuilderInterface
    {
        if ($this->node instanceof ObjectNode) {
            return $this->addToObjectNode(...$arguments);
        }

        return $this->addToArrayNode(...$arguments);
    }