Skip to content

Commit

Permalink
small client updates while I procrastinate on tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dcarbone committed Jan 6, 2025
1 parent 2a5e411 commit 92ea125
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions template/core/client/class_response_headers.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ public function addLine(string $line): int
}

/**
* Return all parsed values for a given response header, if it exists.
*
* @param string $name
* @return null|array
*/
Expand All @@ -80,6 +82,22 @@ public function get(string $name): null|array
}

/**
* Return the first value for a given response header, if it exists.
*
* @return null|string
*/
public function getFirst(string $name): null|string
{
$v = $this->get($name);
if (null === $v || [] === $v) {
return null;
}
return $v[0];
}

/**
* Returns an iterator containing the raw header lines extracted from the repsonse.
*
* @return iterable
*/
public function getLinesIterator(): iterable
Expand All @@ -88,6 +106,8 @@ public function getLinesIterator(): iterable
}

/**
* Returns an iterator containing the parsed header lines from the response.
*
* @return iterable
*/
public function getParsedIterator(): iterable
Expand Down

0 comments on commit 92ea125

Please sign in to comment.