Skip to content

Instantly share code, notes, and snippets.

@platinize
Created July 2, 2018 07:52
Show Gist options
  • Save platinize/e1758cb293c6014c7f60595ef5f506e7 to your computer and use it in GitHub Desktop.
Save platinize/e1758cb293c6014c7f60595ef5f506e7 to your computer and use it in GitHub Desktop.
2.06_1
<?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