Skip to content

Instantly share code, notes, and snippets.

@pedroborges
Created February 8, 2014 20:28
Show Gist options
  • Save pedroborges/8889709 to your computer and use it in GitHub Desktop.
Save pedroborges/8889709 to your computer and use it in GitHub Desktop.
<?php
class Collection {
protected $collection;
public function add($item)
{
if (is_array($item))
{
return array_map([$this, 'add'], $item);
}
$this->collection[] = $item;
}
public function get()
{
return $this->collection;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment