Jyxo\Svn\Client::callSvn PHP Method

callSvn() protected method

Executes SVN binary with given parameters.
protected callSvn ( string $action, string $user, string $password, array $params ) : Result
$action string Action
$user string Username
$password string User password
$params array Additional parameters
return Result
    protected function callSvn(string $action, string $user, string $password, array $params) : Result
    {
        try {
            $command = escapeshellcmd($this->svnBinary) . ' ' . escapeshellarg($action);
            $command .= $this->getUserString($user);
            $command .= $this->getPasswordString($password);
            switch ($action) {
                case 'add':
                case 'delete':
                    $command .= $this->getAdditionalParams($params, true);
                    break;
                default:
                    $command .= $this->getAdditionalParams($params, false);
                    break;
            }
            try {
                $shell = new \Jyxo\Shell\Client();
                $shell->exec($command, $status);
                return new Result($action, $shell->getOut(), $status);
            } catch (\Jyxo\Shell\Exception $e) {
                throw $e;
            }
        } catch (\Exception $e) {
            throw new Exception(sprintf('SVN %s failed: %s', $action, $e->getMessage()), 0, $e);
        }
    }