Skip to content

Instantly share code, notes, and snippets.

@meadsteve
Last active January 3, 2016 05:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meadsteve/8419414 to your computer and use it in GitHub Desktop.
Save meadsteve/8419414 to your computer and use it in GitHub Desktop.
For when you need something. Anything in php.
<?php
class something implements \ArrayAccess, \Iterator
{
protected $loopable = true;
public function offsetExists($offset)
{
return true;
}
public function offsetGet($offset)
{
return new self();
}
public function offsetSet($offset, $value)
{
}
public function offsetUnset($offset)
{
}
function __get($name)
{
return new self();
}
function __set($name, $value)
{
}
function __call($name, $arguments)
{
return new self();
}
public static function __callStatic($name, $arguments)
{
return new self();
}
function __invoke()
{
return new self();
}
function __toString()
{
return "something";
}
public function current()
{
return new self();
}
public function next()
{
$this->loopable = false;
return new self();
}
public function key()
{
return "something";
}
public function valid()
{
return $this->loopable;
}
public function rewind()
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment