/** * Add category to collection * * @param MarketModel|array $model * * @return Models */ public function add($model) { if (is_array($model)) { // @note: add model type validation. $this->collection[] = MarketModel::getInstance($model); } elseif (is_object($model) && $model instanceof MarketModel) { $this->collection[] = $model; } return $this; }
/** * Add category to collection * * @param ModelParent|ModelChild|ModelVisual|ModelSingle|ModelInfo|Offer|array $searchResult * * @return SearchResults */ public function add($searchResult) { if (is_array($searchResult)) { if (isset($searchResult['model'])) { $this->collection[] = MarketModel::getInstance($searchResult['model']); } if (isset($searchResult['offer'])) { $this->collection[] = new Offer($searchResult['offer']); } } elseif (is_object($searchResult) && ($searchResult instanceof MarketModel || $searchResult instanceof Offer)) { $this->collection[] = $searchResult; } return $this; }