for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Onoi\HttpRequest;
use InvalidArgumentException;
/**
* @license GNU GPL v2+
* @since 1.1
*
* @author mwjames
*/
class RequestResponse {
* @var array
private $fields = array();
public function __construct( array $fields = array() ) {
$this->fields = $fields;
}
* @param string $key
* @param mixed $value
public function set( $key, $value ) {
$this->fields[$key] = $value;
* @return boolean
public function has( $key ) {
return isset( $this->fields[$key] ) || array_key_exists( $key, $this->fields );
* @return string
* @throws InvalidArgumentException
public function get( $key ) {
if ( $this->has( $key ) ) {
return $this->fields[$key];
throw new InvalidArgumentException( "{$key} is an unregistered option" );
* @return array
public function getList() {
return $this->fields;
* @since 1.4
* @param integer $flags
public function asJsonString( $flags = 0 ) {
return json_encode( $this->fields, $flags );