Overrides parent isAncestor to determine based on path.

@param ItemInterface $item  The item to check.
@param mixed         $depth The depth to search.

@return bool
16424
public function isAncestor(ItemInterface $item, $depth = null): bool
    {
        $request = $this->request_stack->getCurrentRequest();

        return 0 === strpos($request->getPathInfo(), $item->getUri());
    }
575419
public function findTreeItem($id, MapperTreeItemInterface $item)
    {
        if ($id === $item->getId()) {
            return $item;
        }
        foreach ($item->getChildren() as $child) {
            if (null !== $treeItem = $this->findTreeItem($id, $child)) {
                return $treeItem;
            }
        }

        return null;
    }
442764
public function index(Item $item)
    {
        $indexed = true;

        $this->type = $item->getType();
        $this->setLogging($item);

        $solrConnections = $this->getSolrConnectionsByItem($item);
        foreach ($solrConnections as $systemLanguageUid => $solrConnection) {
            $this->solr = $solrConnection;

            if (!$this->indexItem($item, $systemLanguageUid)) {
                /*
                 * A single language voting for "not indexed" should make the whole
                 * item count as being not indexed, even if all other languages are
                 * indexed.
                 * If there is no translation for a single language, this item counts
                 * as TRUE since it's not an error which that should make the item
                 * being reindexed during another index run.
                 */
                $indexed = false;
            }
        }

        return $indexed;
    }
695170
public function addLayout(ItemInterface $item)
    {
        if ($this->hasLayout($item->getId()) === true) {
            throw new \RuntimeException(sprintf('A previous layout item exists with the same id: "%s".', $item->getId()));
        }

        $this->layouts[$item->getId()] = $item;
    }
583585
public function add(ItemInterface $item)
    {
        if ($this->has($item->getId()) === true) {
            throw new \RuntimeException(sprintf('A previous item exists with the same id: "%s".', $item->getId()));
        }

        $this->set($item);
    }
245194
protected function isParentItem($line)
	{
		if ($this->_listDepth === 1 || ($marker = $line[0]) !== '*' && $marker !== '#') {
			return false;
		}
		$depthMax = $this->_listDepth - 1;
		if (preg_match('/^(#{1,' . $depthMax . '})[^#]+/', $line, $matches)) {
			return $this->_nestedListTypes[strlen($matches[1])] === 'ol';
		}
		if (preg_match('/^(\*{1,' . $depthMax . '})[^\*]+/', $line, $matches)) {
			return $this->_nestedListTypes[strlen($matches[1])] === 'ul';
		}
		return false;
	}
1042231
public function index(Item $item)
    {
        $this->setLogging($item);

        // check whether we should move on at all
        if (!$this->isPageIndexable($item)) {
            return false;
        }

        $solrConnections = $this->getSolrConnectionsByItem($item);
        foreach ($solrConnections as $systemLanguageUid => $solrConnection) {
            $contentAccessGroups = $this->getAccessGroupsFromContent($item, $systemLanguageUid);

            if (empty($contentAccessGroups)) {
                // might be an empty page w/no content elements or some TYPO3 error / bug
                // FIXME logging needed
                continue;
            }

            foreach ($contentAccessGroups as $userGroup) {
                $this->indexPage($item, $systemLanguageUid, $userGroup);
            }
        }

        return true;
    }
1285630
protected function _renderChildren(ItemInterface $item, array $options)
    {
        if ($options['depth'] !== null) {
            $options['depth'] = $options['depth'] - 1;
        }

        if ($options['matchingDepth'] !== null &&
            $options['matchingDepth'] > 0
        ) {
            $options['matchingDepth'] = $options['matchingDepth'] - 1;
        }

        $children = [];
        foreach ($item->getChildren() as $child) {
            $children[] = $this->_renderItem($child, $options);
        }

        return $children;
    }
1091217
public function hasItem(Item $item, bool $initialOnly = true): bool
    {
        $list = ($initialOnly) ? $this->initialItems : $this->items;
        foreach ($list as $my_item) {
            if (0 === Item::compare($my_item, $item)) {
                return true;
            }
        }
        return false;
    }
1211255
private function menuHelper($item)
    {
        // recurse into submenus
        if (isset($item['submenu']) && is_array($item['submenu'])) {
            $item['submenu'] = $this->menuHelper($item['submenu']);
        }

        if (isset($item['route'])) {
            $item['link'] = $this->resolveRouteToLink($item);
        } elseif (isset($item['path'])) {
            $item = $this->resolvePathToContent($item);
        }

        return $item;
    }
268855
public function anAncestorIsMissing($item)
    {
        $parentColumn = $this->parentColumn;
        if (!$item->$parentColumn) {
            return false;
        }
        if (!$this->has($item->$parentColumn)) {
            return true;
        }
        $parent = $this[$item->$parentColumn];

        return $this->anAncestorIsMissing($parent);
    }
30732
public function getParent ($category, $depth = 1)
		{
			if ($category instanceof $this->_modelClass and $depth > 0)
			{
				if ($category->depth == $depth)
					return $category;
				foreach ($this->_data as $item)
					if ($category->lft > $item->lft and $category->rgt < $item->rgt and $item->depth == $depth)
						return $item;
			}

			return null;
		}
1253291
protected function item($page, $depth, $attributes = array(), $output = true)
    {
        $pageId = $this->getPageId($page);
        $children = $this->getChildren($pageId);

        $hasChildren = false;
        if (count($children) > 0) {
            $hasChildren = true;
            $attributes['class'][] = 'has-children';
            $attributes['class'][] = 'has-sub-menu';
        }

        if ($output) {
            $this->startItem($page, $attributes, $hasChildren);
        }

        if ($this->isActiveItem($pageId) && count($children) > 0 && ($this->args['depth'] <= 0 || $depth < $this->args['depth'])) {
            if ($output) {
                $this->startSubmenu($page);
            }

            $this->walk($children, $depth + 1);

            if ($output) {
                $this->endSubmenu($page);
            }
        }

        if ($output) {
            $this->endItem($page);
        }
    }
554429
private boolean checkFileLevelRelativeToRoot(Path filePath, int depth) {
    if (filePath == null) {
      return false;
    }
    Path path = filePath;
    for (int i = 0; i < depth - 1; i++) {
      path = path.getParent();
    }
    if (!path.getName().equals(folderName)) {
      return false;
    }
    return true;
  }
206530
protected function isPageIndexable(Item $item)
    {

        // TODO do we still need this?
        // shouldn't those be sorted out by the record monitor / garbage collector already?

        $isIndexable = true;
        $record = $item->getRecord();

        if (isset($GLOBALS['TCA']['pages']['ctrl']['enablecolumns']['disabled'])
            && $record[$GLOBALS['TCA']['pages']['ctrl']['enablecolumns']['disabled']]
        ) {
            $isIndexable = false;
        }

        return $isIndexable;
    }
1365437
public function isCanSearch(Item $item, $field)
    {
        if (!in_array($field, $this->supported_fields)) {
            return false;
        }
        if ($this->isCanRefill($item, $field) || $item->getName()) {
            return true;
        }
        /* @var $name \AnimeDb\Bundle\CatalogBundle\Entity\Name */
        foreach ($item->getNames() as $name) {
            if ($name->getName()) {
                return true;
            }
        }

        return false;
    }
471044
public function isInsideIgnored($basename, $pathname, $depth)
    {
        return $this->anyParents($basename, $pathname, $depth, function ($basename, $pathname, $depth) {
            return $this->isDirectoryIgnored($basename, $pathname, $depth);
        });
    }