private function generatePathNodes(PropFind $propFind, array $yieldFirst = null)
    {
        if (null !== $yieldFirst) {
            yield $yieldFirst;
        }
        $newDepth = $propFind->getDepth();
        $path = $propFind->getPath();

        if (self::DEPTH_INFINITY !== $newDepth) {
            --$newDepth;
        }

        $propertyNames = $propFind->getRequestedProperties();
        $propFindType = !empty($propertyNames) ? PropFind::NORMAL : PropFind::ALLPROPS;

        foreach ($this->tree->getChildren($path) as $childNode) {
            if ('' !== $path) {
                $subPath = $path.'/'.$childNode->getName();
            } else {
                $subPath = $childNode->getName();
            }
            $subPropFind = new PropFind($subPath, $propertyNames, $newDepth, $propFindType);

            yield [
                $subPropFind,
                $childNode,
            ];

            if ((self::DEPTH_INFINITY === $newDepth || $newDepth >= 1) && $childNode instanceof ICollection) {
                foreach ($this->generatePathNodes($subPropFind) as $subItem) {
                    yield $subItem;
                }
            }
        }
    }
private function generatePathNodes(PropFind $propFind, array $yieldFirst = null)
    {
        if (null !== $yieldFirst) {
            yield $yieldFirst;
        }
        $newDepth = $propFind->getDepth();
        $path = $propFind->getPath();

        if (self::DEPTH_INFINITY !== $newDepth) {
            --$newDepth;
        }

        $propertyNames = $propFind->getRequestedProperties();
        $propFindType = !empty($propertyNames) ? PropFind::NORMAL : PropFind::ALLPROPS;

        foreach ($this->tree->getChildren($path) as $childNode) {
            if ('' !== $path) {
                $subPath = $path.'/'.$childNode->getName();
            } else {
                $subPath = $childNode->getName();
            }
            $subPropFind = new PropFind($subPath, $propertyNames, $newDepth, $propFindType);

            yield [
                $subPropFind,
                $childNode,
            ];

            if ((self::DEPTH_INFINITY === $newDepth || $newDepth >= 1) && $childNode instanceof ICollection) {
                foreach ($this->generatePathNodes($subPropFind) as $subItem) {
                    yield $subItem;
                }
            }
        }
    }
private function generatePathNodes ( PropFind $ propFind , array $ yieldFirst = null ) { if ( null !== $ yieldFirst ) { yield $ yieldFirst ; } $ newDepth = $ propFind -> getDepth ( ) ; $ path = $ propFind -> getPath ( ) ; if ( self :: DEPTH_INFINITY !== $ newDepth ) { -- $ newDepth ; } $ propertyNames = $ propFind -> getRequestedProperties ( ) ; $ propFindType = ! empty ( $ propertyNames ) ? PropFind :: NORMAL : PropFind :: ALLPROPS ; foreach ( $ this -> tree -> getChildren ( $ path ) as $ childNode ) { if ( '' !== $ path ) { $ subPath = $ path . '/' . $ childNode -> getName ( ) ; } else { $ subPath = $ childNode -> getName ( ) ; } $ subPropFind = new PropFind ( $ subPath , $ propertyNames , $ newDepth , $ propFindType ) ; yield [ $ subPropFind , $ childNode , ] ; if ( ( self :: DEPTH_INFINITY === $ newDepth || $ newDepth >= 1 ) && $ childNode instanceof ICollection ) { foreach ( $ this -> generatePathNodes ( $ subPropFind ) as $ subItem ) { yield $ subItem ; } } } }
Small helper to support PROPFIND with DEPTH_INFINITY.

@param PropFind $propFind
@param array    $yieldFirst

@return \Traversable
Small helper to support PROPFIND with DEPTH_INFINITY .