mapper = [ 'amount-of-money' => [ 'name' => 'Amount Of Money', 'param' => SearchersCollection::PARAM_REQUIRED ], 'credit-card-number' => [ 'name' => 'Credit Card Number', 'param' => SearchersCollection::PARAM_REQUIRED ], 'distance' => [ 'name' => 'Distance', 'param' => SearchersCollection::PARAM_REQUIRED ], 'duration' => [ 'name' => 'Duration', 'param' => SearchersCollection::PARAM_REQUIRED ], 'email' => [ 'name' => 'Email', 'param' => SearchersCollection::PARAM_OPTIONAL ], 'numeral' => [ 'name' => 'Numeral', 'param' => SearchersCollection::PARAM_REQUIRED ], 'ordinal' => [ 'name' => 'Ordinal', 'param' => SearchersCollection::PARAM_REQUIRED ], 'phone-number' => [ 'name' => 'Phone Number', 'param' => SearchersCollection::PARAM_REQUIRED ], 'quantity' => [ 'name' => 'Quantity', 'param' => SearchersCollection::PARAM_REQUIRED ], 'temperature' => [ 'name' => 'Temperature', 'param' => SearchersCollection::PARAM_REQUIRED ], 'time' => [ 'name' => 'Time', 'param' => SearchersCollection::PARAM_REQUIRED ], 'url' => [ 'name' => 'URL', 'param' => SearchersCollection::PARAM_REQUIRED ], 'volume' => [ 'name' => 'Volume', 'param' => SearchersCollection::PARAM_REQUIRED ], ]; } public function getSearchers() { return array_keys($this->mapper); } public function all() { $items = []; foreach ($this->mapper as $key => $value) { $items[$key] = [ 'id' => $key, 'name' => $value['name'], 'param' => $value['param'] ]; } return $items; } public function has($id) { return in_array($id, $this->getSearchers()); } public function get($id) { if ( ! $this->has($id)) { return null; } return array_merge($this->mapper[$id], [ 'id' => $id, 'description' => '', ]); } }