library/Garp/Deploy/Config.php
protected function _parseContent($content) {
        $output = array();
        $matches = array();
        $paramsString = implode('|', $this->_deployParams);
        $pattern = '/:?(?P<paramName>' . $paramsString
            . ')[,:]? [\'"](?P<paramValue>[^\'"]*)[\'"]/';

        if (!preg_match_all($pattern, $content, $matches)) {
            throw new Exception(
                "Could not extract deploy parameters from "
                . self::GENERIC_CONFIG_PATH
            );
        }

        foreach ($this->_deployParams as $p) {
            $indices = array_keys(
                array_filter(
                    $matches['paramName'], function ($pn) use ($p) {
                        return $pn === $p;
                    }
                )
            );
            if (!count($indices)) {
                continue;
            }
            $output[$p] = array_values(array_get_subset($matches['paramValue'], $indices));

            // For now: only treat the server param as array (since it's common for it to be an
            // array, in the case of a multi-server setup)
            if ($p !== 'server') {
                $output[$p] = $output[$p][0];
            }
        }

        // explode server into user and server parts
        if (!empty($output['server'])) {
            $output['server'] = array_map(
                function ($serverConfig) {
                    $bits = explode('@', $serverConfig, 2);
                    return array(
                    'user' => $bits[0],
                    'server' => $bits[1]
                    );
                }, $output['server']
            );
        }

        return $output;
    }
protected function _parseContent($content) {
        $output = array();
        $matches = array();
        $paramsString = implode('|', $this->_deployParams);
        $pattern = '/:?(?P<paramName>' . $paramsString
            . ')[,:]? [\'"](?P<paramValue>[^\'"]*)[\'"]/';

        if (!preg_match_all($pattern, $content, $matches)) {
            throw new Exception(
                "Could not extract deploy parameters from "
                . self::GENERIC_CONFIG_PATH
            );
        }

        foreach ($this->_deployParams as $p) {
            $indices = array_keys(
                array_filter(
                    $matches['paramName'], function ($pn) use ($p) {
                        return $pn === $p;
                    }
                )
            );
            if (!count($indices)) {
                continue;
            }
            $output[$p] = array_values(array_get_subset($matches['paramValue'], $indices));

            // For now: only treat the server param as array (since it's common for it to be an
            // array, in the case of a multi-server setup)
            if ($p !== 'server') {
                $output[$p] = $output[$p][0];
            }
        }

        // explode server into user and server parts
        if (!empty($output['server'])) {
            $output['server'] = array_map(
                function ($serverConfig) {
                    $bits = explode('@', $serverConfig, 2);
                    return array(
                    'user' => $bits[0],
                    'server' => $bits[1]
                    );
                }, $output['server']
            );
        }

        return $output;
    }
protected function _parseContent ( $ content ) { $ output = array ( ) ; $ matches = array ( ) ; $ paramsString = implode ( '|' , $ this -> _deployParams ) ; $ pattern = '/:?(?P<paramName>' . $ paramsString . ')[,:]? [\'"](?P<paramValue>[^\'"]*)[\'"]/' ; if ( ! preg_match_all ( $ pattern , $ content , $ matches ) ) { throw new Exception ( "Could not extract deploy parameters from " . self :: GENERIC_CONFIG_PATH ) ; } foreach ( $ this -> _deployParams as $ p ) { $ indices = array_keys ( array_filter ( $ matches [ 'paramName' ] , function ( $ pn ) use ( $ p ) { return $ pn === $ p ; } ) ) ; if ( ! count ( $ indices ) ) { continue ; } $ output [ $ p ] = array_values ( array_get_subset ( $ matches [ 'paramValue' ] , $ indices ) ) ; // For now: only treat the server param as array (since it's common for it to be an // array, in the case of a multi-server setup) if ( $ p !== 'server' ) { $ output [ $ p ] = $ output [ $ p ] [ 0 ] ; } } // explode server into user and server parts if ( ! empty ( $ output [ 'server' ] ) ) { $ output [ 'server' ] = array_map ( function ( $ serverConfig ) { $ bits = explode ( '@' , $ serverConfig , 2 ) ; return array ( 'user' => $ bits [ 0 ] , 'server' => $ bits [ 1 ] ) ; } , $ output [ 'server' ] ) ; } return $ output ; }
Parses the generic configuration.

@param String $content
@return Array
Parses the generic configuration .