protected function parseVersion($version, $prefix)
    {
        $response = [];

        if (preg_match('%(?<major>\d+)((\.(?<minor>\d+)((\.(?<patch>\d+))|$))|$)%', $version, $match)) {
            $pieces = [];

            foreach ($match as $key => $value) {
                if ($key === 'major' || $key === 'minor' || $key === 'patch') {
                    $pieces[] = $response[$prefix . 'Version' . ucfirst($key)] = (int) $value;
                }
            }

            if ( ! empty($pieces)) {
                $response[$prefix . 'Version'] = implode('.', $pieces);
            }
        }

        return $response;
    }
protected function parseVersion($version, $prefix)
    {
        $response = [];

        if (preg_match('%(?<major>\d+)((\.(?<minor>\d+)((\.(?<patch>\d+))|$))|$)%', $version, $match)) {
            $pieces = [];

            foreach ($match as $key => $value) {
                if ($key === 'major' || $key === 'minor' || $key === 'patch') {
                    $pieces[] = $response[$prefix . 'Version' . ucfirst($key)] = (int) $value;
                }
            }

            if ( ! empty($pieces)) {
                $response[$prefix . 'Version'] = implode('.', $pieces);
            }
        }

        return $response;
    }
protected function parseVersion ( $ version , $ prefix ) { $ response = [ ] ; if ( preg_match ( '%(?<major>\d+)((\.(?<minor>\d+)((\.(?<patch>\d+))|$))|$)%' , $ version , $ match ) ) { $ pieces = [ ] ; foreach ( $ match as $ key => $ value ) { if ( $ key === 'major' || $ key === 'minor' || $ key === 'patch' ) { $ pieces [ ] = $ response [ $ prefix . 'Version' . ucfirst ( $ key ) ] = ( int ) $ value ; } } if ( ! empty ( $ pieces ) ) { $ response [ $ prefix . 'Version' ] = implode ( '.' , $ pieces ) ; } } return $ response ; }
Parse semantic version strings into major.minor.patch pieces.

@param string $version
@param string $prefix
@return array
Parse semantic version strings into major . minor . patch pieces .