/** * Checks if a property can be decorated. * * @param Property $property The property that may be decorated. * * @return boolean * @throws PageFactoryException When class of non-existing element discovered in property's @var annotation. */ protected function canDecorate(Property $property) { $data_type = $property->getDataType(); if (!$data_type || $property->isSimpleDataType() || interface_exists($data_type)) { return false; } if (!class_exists($data_type)) { $message = '"%s" element not recognised. "%s" class not found'; throw new PageFactoryException(sprintf($message, $property, $data_type), PageFactoryException::TYPE_UNKNOWN_CLASS); } return true; }