Horde_Push_Factory_Push::_parseArgument PHP Method

_parseArgument() private method

Parse an argument into a Horde_Push element.
private _parseArgument ( string $argument, array $conf ) : Horde_Push
$argument string A single command line argument.
$conf array The configuration.
return Horde_Push The element to be pushed.
    private function _parseArgument($argument, $conf)
    {
        $elements = explode('://', $argument);
        if (isset($elements[0])) {
            $argument = substr($argument, strlen($elements[0]) + 3);
            if (empty($argument)) {
                throw new Horde_Push_Exception('Missing file path!');
            }
            switch ($elements[0]) {
                case 'kolab':
                    return $this->_parseKolab($argument, $conf);
                case 'php':
                    return $this->_parsePhp($argument, $conf);
                case 'yaml':
                    return $this->_parseYaml($argument, $conf);
                case 'empty':
                    return new Horde_Push();
            }
        }
        throw new Horde_Push_Exception(sprintf('Invalid command line arguments: %s!', $argument));
    }