for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @author Boudewijn Schoon <[email protected]>
* @copyright Zicht Online <http://zicht.nl>
*/
namespace Zicht\Itertools\lib\Traits;
trait ArrayAccessTrait
{
* Returns true when a key exists of the same type and value as $OFFSET
*
* @param mixed $offset
* @return bool
public function offsetExists($offset)
foreach ($this as $key => $_) {
$this
this<Zicht\Itertools\lib\Traits\ArrayAccessTrait>
if ($key === $offset) {
return true;
}
return false;
* Returns the value of a key with the same type and value as $OFFSET, or returns
* $DEFAULT when it this key does not exist
* @param mixed $default
* @return mixed
public function offsetGet($offset, $default = null)
foreach ($this as $key => $value) {
return $value;
return $default;
* Not implemented
* @param mixed $value
public function offsetSet($offset, $value)
$offset
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
$value
throw new \RuntimeException('It is not possible to set iterator values');
public function offsetUnset($offset)
throw new \RuntimeException('It is not possible to unset iterator values');