OAuth2\HttpClient::parseStringToArray PHP Method

parseStringToArray() public static method

example: param1=value1¶m2=value2 will result with delimiters & and = to array( 'param1' => 'value1', 'param2' => 'value2', )
public static parseStringToArray ( string $string, string $firstDelimiter, string $secondDelimiter ) : array
$string string
$firstDelimiter string
$secondDelimiter string
return array
    public static function parseStringToArray($string, $firstDelimiter, $secondDelimiter)
    {
        $resultArray = array();
        $parts = explode($firstDelimiter, $string);
        foreach ($parts as $part) {
            $partsPart = explode($secondDelimiter, $part);
            $resultArray[$partsPart[0]] = isset($partsPart[1]) ? trim($partsPart[1]) : '';
        }
        return $resultArray;
    }