public function testGetNodeNamesPattern() { $iterator = $this->node->getNodeNames('id*'); $names = array(); foreach ($iterator as $n) { array_push($names, $n); } $this->assertContains('idExample', $names); $this->assertNotContains('index.txt', $names); }
/** * This method will either let the transport filter if that is possible or * forward to getNodes and return the names of the nodes found there., * * @param NodeInterface $node * @param string|array $nameFilter * @param string|array $typeFilter * * @return ArrayIterator */ public function filterChildNodeNamesByType(NodeInterface $node, $nameFilter, $typeFilter) { if ($this->transport instanceof NodeTypeFilterInterface) { return $this->transport->filterChildNodeNamesByType($node->getPath(), $node->getNodeNames($nameFilter), $typeFilter); } // fallback: get the actual nodes and let that filter. this is expensive. return new ArrayIterator(array_keys($node->getNodes($nameFilter, $typeFilter)->getArrayCopy())); }
/** * {@inheritdoc} */ public function getNodeNames($nameFilter = null, $typeFilter = null) { return $this->node->getNodeNames($nameFilter, $typeFilter); }