/** * Check if specification is met. * * @param string $type * * @return bool */ public function isSatisfiedBy($type) { foreach ($this->holderTypeRepository->getAllTypes() as $validType) { if ($validType->name == $type) { return true; } } return false; }
/** * Initialise holder type properties if valid type. * * @param $type * * @return HolderType * @throws InvalidHolderTypeException */ private function constructValidHolderType($type) { if ($this->isValid($type)) { $storedType = $this->holderTypeRepository->getType($type); $type = $this; $type->typeName = $storedType->name; $type->holder = $storedType->className; return $type; } throw new InvalidHolderTypeException('Type: ' . $type); }