Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Finder.php

function Finder::depth

Adds tests for the directory depth.

Usage:

$finder->depth('> 1') // the Finder will start matching at level 1. $finder->depth('< 3') // the Finder will descend at most 3 levels of directories below the starting point. $finder->depth(['>= 1', '< 3'])

Parameters

string|int|string[]|int[] $levels The depth level expression or an array of depth levels:

Return value

$this

See also

DepthRangeFilterIterator

NumberComparator

File

vendor/symfony/finder/Finder.php, line 124

Class

Finder
Finder allows to build rules to find files and directories.

Namespace

Symfony\Component\Finder

Code

public function depth(string|int|array $levels) : static {
    foreach ((array) $levels as $level) {
        $this->depths[] = new NumberComparator($level);
    }
    return $this;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal