public function map($color) { $vboxes_size = $this->vboxes->size(); for ($i = 0; $i < $vboxes_size; $i++) { $vbox = $this->vboxes->peek($i); if ($vbox['vbox']->contains($color)) { return $vbox['color']; } } return $this->nearest($color); }