for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file is part of phpab/phpab. (https://github.com/phpab/phpab)
*
* @link https://github.com/phpab/phpab for the canonical source repository
* @copyright Copyright (c) 2015-2016 phpab. (https://github.com/phpab/)
* @license https://raw.githubusercontent.com/phpab/phpab/master/LICENSE.md MIT
*/
namespace PhpAb\Storage\Adapter;
* Stores the participation state of the user only for the current request.
* @package PhpAb
class Runtime implements AdapterInterface
{
* @var array The data that has been set.
private $data;
* Initializes a new instance of this class.
* @param array $data
public function __construct(array $data = [])
$this->data = $data;
}
* {@inheritDoc}
public function has($identifier)
return array_key_exists($identifier, $this->data);
public function get($identifier)
if (!$this->has($identifier)) {
return null;
return $this->data[$identifier];
public function set($identifier, $value)
$this->data[$identifier] = $value;
public function all()
return $this->data;
public function remove($identifier)
$removedValue = $this->data[$identifier];
unset($this->data[$identifier]);
return $removedValue;
public function clear()
$removedValues = $this->data;
$this->data = [];
return $removedValues;