public getPropertiesByPath ( $absPaths ) : ArrayIterato\ArrayIterator | ||
$absPaths | ||
return | ArrayIterato\ArrayIterator | that contains all found PropertyInterface instances keyed by their path |
public function getPropertiesByPath($absPaths)
{
// list of nodes to fetch
$nodemap = array();
// ordered list of what to return
$returnmap = array();
foreach ($absPaths as $path) {
list($name, $nodep) = $this->getNodePath($path);
if (!isset($nodemap[$nodep])) {
$nodemap[$nodep] = $nodep;
}
$returnmap[$path] = array('name' => $name, 'path' => $nodep);
}
$nodes = $this->getNodesByPath($nodemap);
$properties = array();
foreach ($returnmap as $key => $data) {
if (isset($nodes[$data['path']]) && $nodes[$data['path']]->hasProperty($data['name'])) {
$properties[$key] = $nodes[$data['path']]->getProperty($data['name']);
}
}
return new ArrayIterator($properties);
}
public function getProperties($absPaths) { if (!is_array($absPaths) && !$absPaths instanceof \Traversable) { $hint = is_object($absPaths) ? get_class($absPaths) : gettype($absPaths); throw new InvalidArgumentException("Not a valid array or Traversable: {$hint}"); } return $this->objectManager->getPropertiesByPath($absPaths); }