id = $id; $this->positive = $positive; $this->term = $term; $this->context = $context; } public function add_querylet(Querylet $q): void { $this->add_img_condition(new ImgCondition($q, $this->positive)); } public function add_img_condition(ImgCondition $c): void { $this->img_conditions[] = $c; } public function add_tag_condition(TagCondition $c): void { $this->tag_conditions[] = $c; } } class SearchTermParseException extends InvalidInput { } class PostListBuildingEvent extends Event { /** @var string[] */ public array $search_terms = []; /** @var array */ public array $parts = []; /** * @param string[] $search */ public function __construct(array $search) { parent::__construct(); $this->search_terms = $search; } public function add_control(string $html, int $position = 50): void { while (isset($this->parts[$position])) { $position++; } $this->parts[$position] = $html; } }