/**
* get itemprop given value && set the couple in Card
*
* if isItemref is set to true, then only itemprop who have no direct itemscope parent in node will be recorded
*
* @param Crawler $node
* @param iCard $card
* @param boolean $isItemref
* @return boolean
*/
private function setCardProperty(Crawler $node, CardInterface $card, $isItemref = false)
{
$property = $node->attr('itemprop');
$nd = $node;
if ($node->parents()->attr('itemscope') !== null) {
return false;
}
if ($this->nestedScope($node, $card, $property, $isItemref)) {
return true;
}
if ($this->manageRawProperty($node, $property, $card)) {
return true;
}
if ($this->manageImgProperty($node, $property, $card)) {
return true;
}
if ($this->manageLinkProperty($node, $property, $card)) {
return true;
}
if ($this->manageNumericProperty($node, $property, $card)) {
return true;
}
if ($isItemref) {
while (count($nd)) {
if ($nd->attr('itemscope') !== null) {
return true;
}
$nd = $nd->parents();
}
}
$card->{$property} = trim($node->text());
}