/** * Perform actual decoration. * * @param Property $property The property that may be decorated. * @param IElementLocator $locator Locator. * * @return IProxy|null */ protected function doDecorate(Property $property, IElementLocator $locator) { $proxy_class = $this->getProxyClass($property); if (!$proxy_class) { return null; } if ($this->_isBEMBlock($property) || $this->_isBEMElement($property)) { /* @var $annotations BEMAnnotation[] */ $annotations = $property->getAnnotationsFromPropertyOrClass('@bem'); $this->_assertAnnotationUsage($annotations, $locator); $name = $this->_isBEMBlock($property) ? $annotations[0]->block : $annotations[0]->element; /* @var $proxy IProxy */ $proxy = new $proxy_class($name, $locator, $this->pageFactory); $proxy->setClassName($property->getDataType()); $proxy->setContainer($locator->getSearchContext()); return $proxy; } return parent::doDecorate($property, $locator); }