/** * @param mixed $other * @return bool */ public function matches($other) { $this->validator = new Validator(); $this->validator->addModel($this->model); $valid = $this->validator->validate($this->model->getName(), $other); return $valid; }
public function addModel(Model $model) { if (isset($this->models[$model->getName()])) { throw new ModelAlreadyDefined("Model " . $model->getName() . " is already defined."); } // Set error container $model->setErrors($this->errors); // Add the model. $this->models[$model->getName()] = $model; }
public function __construct(Model $model, $name = null) { $this->model = $model; if (!isset($name)) { $name = $model->getName(); } parent::__construct($name); }