Source of file ArrayAccess.php
Size: 1,524 Bytes - Last Modified: 2017-11-08T13:54:24+00:00
/home/travis/build/bluzphp/framework/src/Common/Container/ArrayAccess.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 | <?php /** * Bluz Framework Component * * @copyright Bluz PHP Team * @link https://github.com/bluzphp/framework */ declare(strict_types=1); namespace Bluz\Common\Container; /** * Container implements ArrayAccess * * @package Bluz\Common * @author Anton Shevchuk * @see ArrayAccess * * @method void doSetContainer($key, $value) * @method mixed doGetContainer($key) * @method bool doContainsContainer($key) * @method void doDeleteContainer($key) */ trait ArrayAccess { /** * Offset to set * * @param mixed $offset * @param mixed $value * * @throws \InvalidArgumentException */ public function offsetSet($offset, $value) { if (is_null($offset)) { throw new \InvalidArgumentException('Class `Common\Container\ArrayAccess` support only associative arrays'); } $this->doSetContainer($offset, $value); } /** * Offset to retrieve * * @param mixed $offset * * @return string */ public function offsetGet($offset) { return $this->doGetContainer($offset); } /** * Whether a offset exists * * @param mixed $offset * * @return bool */ public function offsetExists($offset) { return $this->doContainsContainer($offset); } /** * Offset to unset * * @param mixed $offset */ public function offsetUnset($offset) { $this->doDeleteContainer($offset); } } |