private function parseCookies($str) {  
	    
	    if(false === is_string($str)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($str)), E_USER_ERROR);
		}

	    $jar 	 = [];
		$headers = explode("\n", trim($str));

		foreach($headers as $header) {

			if(preg_match('/^set-cookie: /i', $header)) {
				
				$cookie = [];

				//Match name and value
				preg_match('/^set-cookie: ([^=]+)=([^;]+)/i', $header, $match);

				if(count($match) === 3) {
					
					$cookie['name']  = $match[1];
					$cookie['value'] = $match[2];
				
					//Match expires
					$cookie['expires'] = null;

					preg_match('/; expires=([^;]+)/i', $header, $match);

					if(count($match) === 2) {
						$cookie['expires'] = strtotime(urldecode(trim($match[1])));
					}

					//Match domain
					$cookie['domain'] = null;

					preg_match('/; domain=([^;]+)/i', $header, $match);

					if(count($match) === 2) {
						$cookie['domain'] = urldecode(trim($match[1]));
					}

					//Match secure
					$cookie['secure'] = false;

					preg_match('/; secure/i', $header, $match);

					if(count($match) === 1) {
						$cookie['secure'] = true;
					}

					//Match httponly
					$cookie['httponly'] = false;

					preg_match('/; httponly/i', $header, $match);

					if(count($match) === 1) {
						$cookie['httponly'] = true;
					}

					//Add cookie to the jar
					if(count($cookie) > 0) {
						$jar[] = $cookie;
					}
				}
			}
		}

		return $jar;
	}
private function parseCookies($str) {  
	    
	    if(false === is_string($str)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($str)), E_USER_ERROR);
		}

	    $jar 	 = [];
		$headers = explode("\n", trim($str));

		foreach($headers as $header) {

			if(preg_match('/^set-cookie: /i', $header)) {
				
				$cookie = [];

				//Match name and value
				preg_match('/^set-cookie: ([^=]+)=([^;]+)/i', $header, $match);

				if(count($match) === 3) {
					
					$cookie['name']  = $match[1];
					$cookie['value'] = $match[2];
				
					//Match expires
					$cookie['expires'] = null;

					preg_match('/; expires=([^;]+)/i', $header, $match);

					if(count($match) === 2) {
						$cookie['expires'] = strtotime(urldecode(trim($match[1])));
					}

					//Match domain
					$cookie['domain'] = null;

					preg_match('/; domain=([^;]+)/i', $header, $match);

					if(count($match) === 2) {
						$cookie['domain'] = urldecode(trim($match[1]));
					}

					//Match secure
					$cookie['secure'] = false;

					preg_match('/; secure/i', $header, $match);

					if(count($match) === 1) {
						$cookie['secure'] = true;
					}

					//Match httponly
					$cookie['httponly'] = false;

					preg_match('/; httponly/i', $header, $match);

					if(count($match) === 1) {
						$cookie['httponly'] = true;
					}

					//Add cookie to the jar
					if(count($cookie) > 0) {
						$jar[] = $cookie;
					}
				}
			}
		}

		return $jar;
	}
private function parseCookies ( $ str ) { if ( false === is_string ( $ str ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ str ) ) , E_USER_ERROR ) ; } $ jar = [ ] ; $ headers = explode ( "\n" , trim ( $ str ) ) ; foreach ( $ headers as $ header ) { if ( preg_match ( '/^set-cookie: /i' , $ header ) ) { $ cookie = [ ] ; //Match name and value
 preg_match ( '/^set-cookie: ([^=]+)=([^;]+)/i' , $ header , $ match ) ; if ( count ( $ match ) === 3 ) { $ cookie [ 'name' ] = $ match [ 1 ] ; $ cookie [ 'value' ] = $ match [ 2 ] ; //Match expires
 $ cookie [ 'expires' ] = null ; preg_match ( '/; expires=([^;]+)/i' , $ header , $ match ) ; if ( count ( $ match ) === 2 ) { $ cookie [ 'expires' ] = strtotime ( urldecode ( trim ( $ match [ 1 ] ) ) ) ; } //Match domain
 $ cookie [ 'domain' ] = null ; preg_match ( '/; domain=([^;]+)/i' , $ header , $ match ) ; if ( count ( $ match ) === 2 ) { $ cookie [ 'domain' ] = urldecode ( trim ( $ match [ 1 ] ) ) ; } //Match secure
 $ cookie [ 'secure' ] = false ; preg_match ( '/; secure/i' , $ header , $ match ) ; if ( count ( $ match ) === 1 ) { $ cookie [ 'secure' ] = true ; } //Match httponly
 $ cookie [ 'httponly' ] = false ; preg_match ( '/; httponly/i' , $ header , $ match ) ; if ( count ( $ match ) === 1 ) { $ cookie [ 'httponly' ] = true ; } //Add cookie to the jar
 if ( count ( $ cookie ) > 0 ) { $ jar [ ] = $ cookie ; } } } } return $ jar ; }
Parses the cookies from the headers and forms it into an Array
@param string $str
@return array
Parses the cookies from the headers and forms it into an Array