public function extend($api) { foreach ($api as $name => $value) { if ($value instanceof \Closure) { $value = $value->bindTo($this, $this); } $this->apis[$name] = $value; } }