protected static function containsMatchingChildren( SplFileInfo $dir, array $matchers = [] ) {
		if ( empty( $matchers ) ) {
			return false;
		}

		/** @var string $root_relative_path */
		$root_relative_path = str_replace( static::$dir, '', $dir->getPathname() );

		foreach ( $matchers as $path_or_file ) {
			// If the matcher contains no wildcards and the path matches the start of the matcher.
			if (
				'' !== $root_relative_path &&
				false === strpos( $path_or_file, '*' ) &&
				0 === strpos( $path_or_file . '/', $root_relative_path )
			) {
				return true;
			}

			$base = current( explode( '*', $path_or_file ) );

			// If start of the path matches the start of the matcher until the first wildcard.
			// Or the start of the matcher until the first wildcard matches the start of the path.
			if (
				( '' !== $root_relative_path && 0 === strpos( $base, $root_relative_path ) ) ||
				0 === strpos( $root_relative_path, $base )
			) {
				return true;
			}
		}

		return false;
	}
protected static function containsMatchingChildren( SplFileInfo $dir, array $matchers = [] ) {
		if ( empty( $matchers ) ) {
			return false;
		}

		/** @var string $root_relative_path */
		$root_relative_path = str_replace( static::$dir, '', $dir->getPathname() );

		foreach ( $matchers as $path_or_file ) {
			// If the matcher contains no wildcards and the path matches the start of the matcher.
			if (
				'' !== $root_relative_path &&
				false === strpos( $path_or_file, '*' ) &&
				0 === strpos( $path_or_file . '/', $root_relative_path )
			) {
				return true;
			}

			$base = current( explode( '*', $path_or_file ) );

			// If start of the path matches the start of the matcher until the first wildcard.
			// Or the start of the matcher until the first wildcard matches the start of the path.
			if (
				( '' !== $root_relative_path && 0 === strpos( $base, $root_relative_path ) ) ||
				0 === strpos( $root_relative_path, $base )
			) {
				return true;
			}
		}

		return false;
	}
protected static function containsMatchingChildren ( SplFileInfo $ dir , array $ matchers = [ ] ) { if ( empty ( $ matchers ) ) { return false ; } /** @var string $root_relative_path */ $ root_relative_path = str_replace ( static :: $ dir , '' , $ dir -> getPathname ( ) ) ; foreach ( $ matchers as $ path_or_file ) { // If the matcher contains no wildcards and the path matches the start of the matcher. if ( '' !== $ root_relative_path && false === strpos ( $ path_or_file , '*' ) && 0 === strpos ( $ path_or_file . '/' , $ root_relative_path ) ) { return true ; } $ base = current ( explode ( '*' , $ path_or_file ) ) ; // If start of the path matches the start of the matcher until the first wildcard. // Or the start of the matcher until the first wildcard matches the start of the path. if ( ( '' !== $ root_relative_path && 0 === strpos ( $ base , $ root_relative_path ) ) || 0 === strpos ( $ root_relative_path , $ base ) ) { return true ; } } return false ; }
Determines whether or not a directory has children that may be matched.

@param SplFileInfo $dir      Directory.
@param array       $matchers List of files and directories to match.
@return bool Whether or not there are any matchers for children of this directory.
Determines whether or not a directory has children that may be matched .