for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Ajax\semantic\components\search;
class SearchCategory implements ISearch {
private $id;
private $name;
private $results;
public function __construct($id, $name, $results=NULL) {
$this->results=new SearchResults($results);
$this->id=$id;
$this->name=$name;
}
public function addResult($object) {
$this->results->addResult($object);
return $this;
public function addResults($objects) {
$this->results->addResults($objects);
public function __toString() {
$result="\"" . $this->id . "\": { \"name\": \"" . $this->name . "\"," . $this->results . "}";
return $result;
public function getId() {
return $this->id;
public function setId($id) {
public function getName() {
return $this->name;
public function setName($name) {
public function getResults() {
return $this->results;
public function setResults($results) {
$this->results=$results;
public function search($query, $field="title") {
$result=$this->results->search($query, $field);
if ($result !== false) {
return new SearchCategory($this->id, $this->name, $result);
return false;
public function getResponse() {
return $this->__toString();