Created
July 2, 2018 07:52
-
-
Save platinize/e1758cb293c6014c7f60595ef5f506e7 to your computer and use it in GitHub Desktop.
2.06_1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace godzula\Container; | |
use ArrayAccess; | |
class Container implements ArrayAccess { | |
private $container = array(); | |
public function __construct() { | |
$this->container = [ | |
"a" => 1, | |
"b" => 2, | |
"c" => 3, | |
]; | |
} | |
public function offsetSet($offset, $value) { | |
return $this->container[$offset] = $value; | |
} | |
public function offsetExists($offset) { | |
return isset($this->container[$offset]); | |
} | |
public function offsetUnset($offset) { | |
unset($this->container[$offset]); | |
} | |
public function offsetGet($offset) { | |
return isset($this->container[$offset]) ? $this->container[$offset] : null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment