private function parseNameValuePairs(string $nameValuePairs): array
    {
        $parsedNameValuePairs = [];
        $nameValuePairs = explode(',', $nameValuePairs);
        foreach ($nameValuePairs as $nameValuePair) {
            // Trim the Whitespace from the start and end of the name value pair string
            $nameValuePair = trim($nameValuePair);
            // Split $nameValuePair (name=value) into $name and $value
            list($name, $value) = explode('=', $nameValuePair, 2);
            // Remove quotes if the string is quoted
            $value = $this->unquoteString($value);
            // Add pair to array[name] => value
            $parsedNameValuePairs[$name] = $value;
        }

        return $parsedNameValuePairs;
    }
private function parseNameValuePairs(string $nameValuePairs): array
    {
        $parsedNameValuePairs = [];
        $nameValuePairs = explode(',', $nameValuePairs);
        foreach ($nameValuePairs as $nameValuePair) {
            // Trim the Whitespace from the start and end of the name value pair string
            $nameValuePair = trim($nameValuePair);
            // Split $nameValuePair (name=value) into $name and $value
            list($name, $value) = explode('=', $nameValuePair, 2);
            // Remove quotes if the string is quoted
            $value = $this->unquoteString($value);
            // Add pair to array[name] => value
            $parsedNameValuePairs[$name] = $value;
        }

        return $parsedNameValuePairs;
    }
private function parseNameValuePairs ( string $ nameValuePairs ) : array { $ parsedNameValuePairs = [ ] ; $ nameValuePairs = explode ( ',' , $ nameValuePairs ) ; foreach ( $ nameValuePairs as $ nameValuePair ) { // Trim the Whitespace from the start and end of the name value pair string $ nameValuePair = trim ( $ nameValuePair ) ; // Split $nameValuePair (name=value) into $name and $value list ( $ name , $ value ) = explode ( '=' , $ nameValuePair , 2 ) ; // Remove quotes if the string is quoted $ value = $ this -> unquoteString ( $ value ) ; // Add pair to array[name] => value $ parsedNameValuePairs [ $ name ] = $ value ; } return $ parsedNameValuePairs ; }
Parses a string of name=value pairs separated by commas and returns and array with the name as the index.

@param string $nameValuePairs the string containing the name=value pairs

@return array an array with the name used as the index and the values stored within
Parses a string of name = value pairs separated by commas and returns and array with the name as the index .