Is this path subdir of given path?

@param  string $parent Given path to detect.

@return  boolean  Is subdir or not.

@since  2.0
428820
public function isSubdirOf($parent)
    {
        $self = (string) $this;

        $parent = $this->normalize($parent, true);

        // Path is self
        if ($self == $parent) {
            return false;
        }

        // Path is parent
        if (strpos($parent, $self) === 0) {
            return true;
        }

        return false;
    }
790847
public static function isFolder( $path )
	{
		$exists	= file_exists( $path );
		$isDir	= is_dir( $path );
		return $exists && $isDir;
	}
732190
public function checkPath($path)
    {
        $path = realpath($path);

        return ($path !== false && is_dir($path)) ? $path : false;
    }
1132009
public static function isAbsolute($path)
    {
        if ('' === $path) {
            return false;
        }

        Assert::string($path, 'The path must be a string. Got: %s');

        // Strip scheme
        if (false !== ($pos = strpos($path, '://'))) {
            $path = substr($path, $pos + 3);
        }

        // UNIX root "/" or "\" (Windows style)
        if ('/' === $path[0] || '\\' === $path[0]) {
            return true;
        }

        // Windows root
        if (strlen($path) > 1 && ctype_alpha($path[0]) && ':' === $path[1]) {
            // Special case: "C:"
            if (2 === strlen($path)) {
                return true;
            }

            // Normal case: "C:/ or "C:\"
            if ('/' === $path[2] || '\\' === $path[2]) {
                return true;
            }
        }

        return false;
    }
369184
protected function checkPath($path)
    {
        foreach ($this->chroots as $chroot) {
            if (StringHelper::contains($path, $chroot)) {
                return true;
            }
        }
        return false;
    }
741163
protected function isSameFilesystem(
        /*# string */ $path1,
        /*# string */ $path2
    )/*# : bool */ {
        return $this->path($path1)->getFilesystem() === $this->path($path2)->getFilesystem();
    }
609107
public function hasDir($path)
    {
        $meta = $this->getMetadata($path);
        return ($meta && isset($meta['hasdir'])) ? $meta : [
            'hasdir' => true
        ];
    }
27496
protected function grouped_parent_exists($path) {
        // Search the tree structure to find out if one of the paths
        // above the $path is a grouped path.
        $patharray = explode('/', $this->get_parent_path($path));
        $groupedpath = '';
        $currentpos = &$this->groupedparentprefixtree;
        foreach ($patharray as $item) {
            // When the item isn't set in the array we know
            // there is no parent grouped path.
            if (!isset($currentpos[$item])) {
                return false;
            }

            // When we aren't at the start of the path, continue to build
            // a string representation of the path that is traversed.  We will
            // return the grouped path to the caller if we find one.
            if ($item != '') {
                $groupedpath .= '/'.$item;
            }

            if ($currentpos[$item] == array()) {
                return $groupedpath;
            }
            $currentpos = &$currentpos[$item];
        }
        return false;
    }
896330
public function isDirectory(): bool {
		if ($this->isRoot()) {
			return true;
		}

		$content = $this->manager->listContents(
			$this->getParent()->getUrl(),
			false
		);

		return count(
				array_filter(
					$content,
					function ($item) {
						if ($item["basename"] == $this->getName()) {
							return $item["type"] == "dir";
						}

						return false;
					}
				)
			) === 1;
	}
1374832
protected function isParentArchived()
    {
        if ($parentID = $this->ParentID) {
            /** @var SiteTree $parentPage */
            $parentPage = Versioned::get_latest_version(self::class, $parentID);
            if (!$parentPage || !$parentPage->isOnDraft()) {
                return true;
            }
        }
        return false;
    }
147282
public function AddParent($parent)
    {
        $parent = str_replace("::", "\\", $parent);
        
        $this->parents[$parent] = $parent;
        $this->has_parent = true;
        
        return $this;
    }
179102
public static function isSubclassOf($class, $parent)
    {
        if (! is_subclass_of($class, $parent)) {
            if (is_object($class)) {
                $class = get_class($class);
            }
            self::isString($class);
            if ($class === $parent) {
                return;
            }
            if (! class_exists($class)) {
                throw new InvalidArgumentException('Class not found: ' . $class);
            }
            throw new InvalidArgumentException('Class ' . $class . ' should extend ' . $parent);
        }
    }
985614
public static function recursiveRmdir($path, $removeParent = true)
    {
        if (!file_exists($path))
            return true;

        if (!is_dir($path))
            return @unlink($path);

        $objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::CHILD_FIRST);
        foreach ($objects as $item) {
            if ($item == '.' || $item == '..')
                continue;

            if(!is_dir($item))
            {
                if (!@unlink($item))
                    return false;
            } else {
                if(!@rmdir($item))
                    return false;
            }
        }
        return $removeParent ? rmdir($path) : true;
    }
857117
public static boolean isSub(File parent, File sub) {
		Assert.notNull(parent);
		Assert.notNull(sub);
		return sub.toPath().startsWith(parent.toPath());
	}
1016454
public static function isAbsolutePath($path) : bool
    {
        /*
         * This is definitive if true but fails if $path does not exist or contains
         * a symbolic link.
         */
        if (realpath($path) == $path) {
            return true;
        }

        if (strlen($path) == 0 || $path[0] == '.') {
            return false;
        }

        // Windows allows absolute paths like this.
        if (preg_match('#^[a-zA-Z]:\\\\#', $path)) {
            return true;
        }

        // A path starting with / or \ is absolute; anything else is relative.
        return ( $path[0] == '/' || $path[0] == '\\' );
    }
1253453
protected function isWithinFilesystem($path)
    {
        $pathUrl = new Url($path);
        $fsUrl = $this->filesystem->url();

        if (!$pathUrl->scheme) {
            $pathUrl = $pathUrl->scheme('file');
        }

        if (!$fsUrl->scheme) {
            $fsUrl = $fsUrl->scheme('file');
        }

        if ($pathUrl->scheme != $fsUrl->scheme) {
            return false;
        }

        if (Helper::startsWith("$pathUrl->path", "$fsUrl->path")) {
            return true;
        }

        return $this->filesystem->exists($path);
    }
284948
public function isParentOf(AbsolutePathInterface $path)
    {
        if (!$this->matchesDriveOrNull($this->pathDriveSpecifier($path))) {
            return false;
        }

        return parent::isParentOf($path);
    }