Jyxo\Svn\Client::getAdditionalParams PHP Method

getAdditionalParams() protected method

Parameters given in the argument have precedence over values stored in object's attribute. If parameters are given as arrays, they get merged. Returns empty string if no parameters are set in any way.
protected getAdditionalParams ( array $params = [], boolean $pathsOnly = false ) : string
$params array Parameters
$pathsOnly boolean Use only path-parameters (not beginning with a dash "-")
return string
    protected function getAdditionalParams(array $params = [], $pathsOnly = false) : string
    {
        $ret = ' ';
        foreach ($this->additional as $param => $value) {
            // If the key exists in $params or it is numeric, skip it.
            if (isset($params[$param]) && !is_numeric($param)) {
                continue;
            }
            // If we want only paths, skip parameters beginning with a dash "-".
            if ($pathsOnly && ($param[0] == '-' || $value[0] == '-')) {
                continue;
            }
            // If the key is not numeric, add it as well.
            if (!is_numeric($param)) {
                $ret .= ' ' . $param;
            }
            // And finally add the parameter value.
            $ret .= ' ' . $value;
        }
        foreach ((array) $params as $param => $value) {
            // If we want only paths.
            if ($pathsOnly && ($param[0] == '-' || $value[0] == '-')) {
                continue;
            }
            if (!is_numeric($param)) {
                $ret .= ' ' . $param;
            }
            $ret .= ' ' . escapeshellarg($value);
        }
        return $ret;
    }