Exemplo n.º 1
0
 /**
  * Find the element list.
  *
  * @return NodeElement[]
  * @throws ElementException In case no array/collection given and multiple elements found.
  */
 public function findAll()
 {
     $elements = array();
     foreach ($this->getSelectors() as $selector) {
         $elements = array_merge($elements, $this->searchContext->findAll('se', $selector));
     }
     $element_count = count($elements);
     if ($element_count > 1 && !$this->property->isDataTypeArray() && !$this->property->isDataTypeCollection()) {
         throw new ElementException(sprintf('The "%s" used on "%s" property expects finding 1 element, but %s elements were found.', $this->property->getRawDataType(), $this->property, $element_count), ElementException::TYPE_MULTIPLE_ELEMENTS_FOUND);
     }
     return $elements;
 }
Exemplo n.º 2
0
 /**
  * @dataProvider getRawDataTypeDataProvider
  */
 public function testGetRawDataType($data_type, $result)
 {
     $this->expectVarAnnotation($data_type);
     $this->assertSame($result, $this->property->getRawDataType());
 }