filter = new FilterOptions(); $this->presenter = $presenter; } /** * Return a list of categorized things with the given input options and target. * * @param InputInterface $input * @param Reflector $reflector * @param mixed $target * * @return array */ public function enumerate(InputInterface $input, \Reflector $reflector = null, $target = null) { $this->filter->bind($input); return $this->listItems($input, $reflector, $target); } /** * Enumerate specific items with the given input options and target. * * Implementing classes should return an array of arrays: * * [ * 'Constants' => [ * 'FOO' => [ * 'name' => 'FOO', * 'style' => 'public', * 'value' => '123', * ], * ], * ] * * @param InputInterface $input * @param Reflector $reflector * @param mixed $target * * @return array */ abstract protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null); protected function showItem($name) { return $this->filter->match($name); } protected function presentRef($value) { return $this->presenter->presentRef($value); } protected function presentSignature($target) { // This might get weird if the signature is actually for a reflector. Hrm. if (!$target instanceof \Reflector) { $target = Mirror::get($target); } return SignatureFormatter::format($target); } }