/** * Retrieve name of array key attribute, if a node is an associative array * * @param string $nodeXpath * @return string|null */ public function getAssocArrayKeyAttribute($nodeXpath) { foreach ($this->assocArrays as $pathPattern => $keyAttribute) { if ($this->nodePathMatcher->match($pathPattern, $nodeXpath)) { return $keyAttribute; } } return null; }
/** * Retrieve name of an identifier attribute for a node * * @param string $nodeXpath * @return string|null */ public function getIdAttribute($nodeXpath) { foreach ($this->idAttributes as $pathPattern => $idAttribute) { if ($this->nodePathMatcher->match($pathPattern, $nodeXpath)) { return $idAttribute; } } return null; }
/** * @param string $pathPattern * @param string $xpathSubject * @param boolean $expectedResult * * @dataProvider getNodeInfoDataProvider */ public function testMatch($pathPattern, $xpathSubject, $expectedResult) { $actualResult = $this->_model->match($pathPattern, $xpathSubject); $this->assertSame($expectedResult, $actualResult); }