Move the parseHttpHeader function next to the parse function.

This commit is contained in:
Madeorsk 2023-05-26 14:29:13 +02:00
parent 1e20a86e4a
commit a4d73971d3

View File

@ -10,16 +10,6 @@ use Madeorsk\Forwarded\Exceptions\EmptyNodeNameException;
*/ */
class Parser class Parser
{ {
/**
* Parse the HTTP header found in `$_SERVER["HTTP_FORWARDED"]`.
* @return Forwarded - The parsed Forwarded header.
* @throws EmptyNodeNameException
*/
public function parseHttpHeader(): Forwarded
{
return $this->parse($_SERVER["HTTP_FORWARDED"]);
}
/** /**
* The currently reading forwards list. * The currently reading forwards list.
* @var array * @var array
@ -94,6 +84,16 @@ class Parser
return new Forwarded($this->parseAssoc($headerContent)); return new Forwarded($this->parseAssoc($headerContent));
} }
/**
* Parse the HTTP header found in `$_SERVER["HTTP_FORWARDED"]`.
* @return Forwarded - The parsed Forwarded header.
* @throws EmptyNodeNameException
*/
public function parseHttpHeader(): Forwarded
{
return $this->parse($_SERVER["HTTP_FORWARDED"]);
}
/** /**
* Reinitialize the parsing of a pair. * Reinitialize the parsing of a pair.
* @return void * @return void