Builds a shell safe argument list

@param array $arguments arguments to pass to pdftk
@return string list of arguments
171862
protected function _buildArguments($arguments)
    {
        $output = [];

        foreach ($arguments as $argument => $value) {
            $output[] = $argument . ' ' . $value;
        }

        return implode(' ', $output);
    }
279126
private static function checkArgs(array $args) {
        if ($_FILES) {
            foreach ($_FILES as $key => $f) {
                if (is_array($f['name'])) {
                    foreach ($f['tmp_name'] as $tmp) {
                        $args[ $key ][] = self::getfileSha1('@"' . $tmp . '"');
                    }
                } else {
                    $args[ $key ] = self::getfileSha1('@"' . $f['tmp_name'] . '"');
                }
            }
        }

        return $args;
    }
37415
private static function getArguments(array $arguments = [])
    {
        $args = [];

        foreach ($arguments as $argument) {
            $args[] = $argument instanceof self ? $argument->getMoney() : $argument;
        }

        return $args;
    }
299561
public function filterPrefix(array $arguments)
    {
        if (empty($arguments)) {
            throw new InvalidArgumentException('At least one argument needed');
        }

        $path = array_shift($arguments);

        if ( ! is_string($path)) {
            throw new InvalidArgumentException('First argument should be a string');
        }

        list($prefix, $path) = $this->getPrefixAndPath($path);
        array_unshift($arguments, $path);

        return [$prefix, $arguments];
    }
967031
private function formatArguments($arguments)
    {
        return collect($arguments)->map(function ($argument) {
            return $argument instanceof Model ? FormatModel::given($argument) : $argument;
        })->toArray();
    }
19324
private function formatArguments($arguments)
    {
        $result = [];
        foreach ($arguments as $key => $argument) {
            if (is_object($argument)) {
                $result[$key] = get_class($argument);
                continue;
            }

            if (is_array($argument)) {
                $result[$key] = $this->formatArguments($argument);
                continue;
            }

            $result[$key] = $argument;
        }

        return $result;
    }
103264
private function formatArguments(Array $arguments)
    {
        $echoArguments = [];
        $argsLength = 0;
        foreach ($arguments as $argument => $desc) {
            $argument = Colour::colour($argument, Colour::GREEN);
            $echoArguments[$argument] = $desc;
            $argsLength > strlen($argument) || $argsLength = strlen($argument);
        }
        return $echoArguments;
    }
265906
public function setArguments(array $arguments)
    {
    	foreach ($arguments as $k => $v) {
    		$this->arguments[$k] = $v;
    	}
        
        return $this;
    }
1072308
public function build(array $arguments = [])
    {
        $arguments = Arrays::arrayMergeRecursiveOverrule($this->arguments, $arguments);
        $arguments = $this->mergeArgumentsWithRequestArguments($arguments);

        $httpRequest = $this->request->getHttpRequest();

        $uriPathPrefix = $this->environment->isRewriteEnabled() ? '' : 'index.php/';
        $uriPathPrefix = $httpRequest->getScriptRequestPath() . $uriPathPrefix;
        $resolveContext = new ResolveContext($httpRequest->getBaseUri(), $arguments, $this->createAbsoluteUri, $uriPathPrefix);
        $resolvedUri = $this->router->resolve($resolveContext);
        if ($this->section !== '') {
            $resolvedUri = $resolvedUri->withFragment($this->section);
        }

        $this->lastArguments = $arguments;
        return (string)$resolvedUri;
    }
754704
public function args(array $arguments)
    {
        // provide a new instance of the scheduler class if this
        // is the first method that was called.  This allows for
        // $scheduler->opts() to return a new instance of the
        // scheduler when it's first called
        if (count($this->options) == 0) {
            $scheduler = App::make(get_called_class());
            $scheduler->setArguments($arguments);

            return $scheduler;
        }

        $this->setArguments($arguments);

        return $this;
    }
1051717
protected function filterPrefix(array $arguments)
    {
        if (empty($arguments)) {
            throw new InvalidArgumentException('The arguments cannot be empty');
        }

        $path = array_shift($arguments);

        if (! Assert::stringNotEmpty($path)) {
            throw new InvalidArgumentException(
                sprintf('"%s" path must be string', __METHOD__)
            );
        }

        list($prefix, $path) = $this->getPrefixAndPath($path);
        array_unshift($arguments, $path);
        unset($path);

        return [$prefix, $arguments];
    }
889834
public static function instanceFromArguments($arguments = []) {
        $arguments = array_values($arguments);
        $argumentsCount = count($arguments);
        for ($i = 0; $i < $argumentsCount; $i++) {
            if (is_object($arguments[$i]) && $arguments[$i] instanceof SharedDataInterface) {
                return $arguments[$i];
            }
        }
        return null;
    }
48395
public function parse_args( $arguments ) {
		list( $positional_args, $mixed_args, $global_assoc, $local_assoc ) = self::extract_assoc( $arguments );
		list( $assoc_args, $runtime_config )                               = $this->unmix_assoc_args( $mixed_args, $global_assoc, $local_assoc );
		return array( $positional_args, $assoc_args, $runtime_config );
	}
576965
protected function _processArguments( $arguments )
    {
        //	Process command line arguments
        $_className = array_shift( $arguments );
        $_options = $this->getArguments( $arguments );
        $arguments = array_merge( array($_className), $_options['rebuilt'] );

        //	Set our values based on options...
        $this->set( $_options );

        return $arguments;
    }
1128137
public static function escape(array $args): string
  {
    $command = '';
    foreach ($args as $arg)
    {
      if ($command!='') $command .= ' ';
      $command .= escapeshellarg($arg);
    }

    return $command;
  }
887192
public function passthru(array $arguments = [])
    {
        passthru($this->getBin() . $this->prepareCommand($arguments), $exitCode);
        return $exitCode;
    }
1347180
protected function getTokens(array $arguments)
    {
        $tokens = array();
        foreach ($arguments as $argument) {
            $argumentTokens = preg_split('/([\s.,!])+/', $argument);
            $tokens = array_merge($tokens, $argumentTokens);
        }

        return array_values(array_filter($tokens));
    }