Check if the entry resides within the parent directory.

@param array $entry

@return bool
773263
private function residesInDirectory(array $entry)
    {
        if ($this->directory === '') {
            return true;
        }

        return $this->caseSensitive
            ? strpos($entry['path'], $this->directory . '/') === 0
            : stripos($entry['path'], $this->directory . '/') === 0;
    }
752469
private function hasAncestorGuid( $entry, $ancestor )
	{
		if (
				( isset( $entry['parent'] ) && isset( $ancestor['parent'] ) && ( $entry['parent'] == $ancestor['parent'] ) ) || // The item is a sibling
				( isset( $entry['parent'] ) && ( $entry['parent'] == $ancestor['guid'] ) ) || // The item is a child
				( $entry['guid'] == $ancestor['guid'] ) // Same
		   )
		{
			return true;
		}

		if ( $entry['guid'] == 'xbrl' || $entry['parent'] == 'xbrl' )
		{
			return false; // If here and the entry guid is xbrl there can be no parent or match
		}

		$parent =& $this->getEntryForGuid( $entry['parent'] );
		if ( ! $parent ) return false;
		return $this->hasAncestorGuid( $parent, $ancestor );
	}
659361
public function isExcludedDirectory($directory)
    {
        foreach ($this->getExcludedDirectories() as $pattern) {
            if (Str::is($pattern, $directory)) return true;
        }

        return false;
    }
621544
public static function validate(array $entries)
    {
        if (!self::loaded()) return false;
        $base = self::$__configurator->getRequired();
        foreach ($entries as $var=>$val) {
            if (in_array($var, $base)) {
                unset($base[array_search($var, $base)]);
            }
        }
        return (count($base)===0);
    }
749444
protected function process_entries(array $entries) {
        global $OUTPUT;

        $dirslist   = [];
        $fileslist  = [];
        foreach ($entries as $entry) {
            $entrydata = $entry;
            if (isset($entrydata->metadata)) {
                // If this is metadata, fetch the metadata content.
                // We only use the consistent parts of the file, folder, and metadata.
                $entrydata = $entrydata->metadata;
            }
            if ($entrydata->{".tag"} === "folder") {
                $dirslist[] = [
                        'title'             => $entrydata->name,
                        // Use the display path here rather than lower.
                        // Dropbox is case insensitive but this leads to more accurate breadcrumbs.
                        'path'              => file_correct_filepath($entrydata->path_display),
                        'thumbnail'         => $OUTPUT->image_url(file_folder_icon(64))->out(false),
                        'thumbnail_height'  => 64,
                        'thumbnail_width'   => 64,
                        'children'          => array(),
                    ];
            } else if ($entrydata->{".tag"} === "file") {
                $fileslist[] = [
                        'title'             => $entrydata->name,
                        // Use the path_lower here to make life easier elsewhere.
                        'source'            => $entrydata->path_lower,
                        'size'              => $entrydata->size,
                        'date'              => strtotime($entrydata->client_modified),
                        'thumbnail'         => $OUTPUT->image_url(file_extension_icon($entrydata->path_lower, 64))->out(false),
                        'realthumbnail'     => $this->get_thumbnail_url($entrydata),
                        'thumbnail_height'  => 64,
                        'thumbnail_width'   => 64,
                    ];
            }
        }

        $fileslist = array_filter($fileslist, array($this, 'filter'));

        return array_merge($dirslist, array_values($fileslist));
    }
313520
protected function parseListEntry( $entry )
	{
		$data	= array();
		$parts	= preg_split("/[\s]+/", $entry, 9 );
		if( $parts[0] == "total" )
			return array();
		$data['isdir']			= $parts[0]{0} === "d";
		$data['islink']			= $parts[0]{0} === "l";
		$data['isfile']			= $parts[0]{0} === "-";
		$data['permissions']	= $parts[0];
		$data['number']			= $parts[1];
		$data['owner']			= $parts[2];
		$data['group']			= $parts[3];
		$data['size']			= $parts[4];
		$data['month']			= $parts[5];
		$data['day']			= $parts[6];
		$data['time']			= $parts[7];
		$data['name']			= $parts[8];
		if( preg_match( "/:/", $data['time'] ) )
			$data['year']		= date( "Y" );
		else
		{
			$data['year']		= $data['time'];
			$data['time']		= "00:00";
		}
		$data['timestamp']		= strtotime( $data['day']." ".$data['month']." ".$data['year']." ".$data['time'] );
		$data['datetime']		= date( "c", $data['timestamp'] );
		$data['type']			= $this->fileTypes[$parts[0]{0}];
		$data['type_short']		= $data['type']{0};
		$data['octal']			= $this->getPermissionsAsOctal( $parts[0] );
		$data['raw']			= $entry;
		return $data;
	}
982739
public function get($entry)
    {
        $value = false;

        foreach ($this->caches as $cache) {
            $value = $cache->get($entry);
            if ($value !== false) {
                return $value;
            }
        }
        return $value;
    }
744215
private function isSkipped(DirectoryIterator $i): bool {
        $isEmptyDir = true;
        if ($i->isDir()) {
            foreach (new DirectoryIterator($i->getPathname()) as $j) {
                if (!$j->isDot()) {
                    $isEmptyDir = false;
                    break;
                }
            }
        }
        $skipDir         = (!$this->includeEmpty && ($this->depth == 0 || $isEmptyDir) || $this->flatStructure);
        $filenameInclude = preg_match($this->filter, $i->getFilename());
        $filenameExclude = strlen($this->filterNot) > 0 && preg_match($this->filterNot, $i->getFilename());
        $skipFile        = !$filenameInclude || $filenameExclude;
        return $i->isDir() && $skipDir || !$i->isDir() && $skipFile;
    }
595691
protected function _createItem( array $entry )
	{
		$item = $this->_manager->createItem();

		foreach( (array) $entry as $name => $value )
		{
			switch( $name )
			{
				case 'catalog.list.id': $item->setId( $value ); break;
				case 'catalog.list.domain': $item->setDomain( $value ); break;
				case 'catalog.list.parentid': $item->setParentId( $value ); break;
				case 'catalog.list.position': $item->setPosition( $value ); break;
				case 'catalog.list.config': $item->setConfig( (array) $value ); break;
				case 'catalog.list.status': $item->setStatus( $value ); break;
				case 'catalog.list.typeid': $item->setTypeId( $value ); break;
				case 'catalog.list.refid': $item->setRefId( $value ); break;
				case 'catalog.list.datestart':
					if( $value != '' )
					{
						$value = str_replace( 'T', ' ', $value );
						$entry->{'catalog.list.datestart'} = $value;
						$item->setDateStart( $value );
					}
					break;
				case 'catalog.list.dateend':
					if( $value != '' )
					{
						$value = str_replace( 'T', ' ', $value );
						$entry->{'catalog.list.dateend'} = $value;
						$item->setDateEnd( $value );
					}
					break;
			}
		}

		return $item;
	}
247231
public final boolean contains(E entry) {
        TreeEntry<E> e = getEntry(entry);
        return e != null;
    }
850093
public function offsetExists($index)
    {
        if (!$exists = parent::offsetExists($index)) {
            if (isset($this->{$index})) {
                return true;
            }
        }
        return $exists;
    }
10453
private function areExpectedDirectoriesPresent(): bool
    {
        $actualDirectories = scandir(getcwd(), 0);

        $presentExpectedDirectories = array_intersect($this->expectedDirectories, $actualDirectories);
        sort($this->expectedDirectories);
        sort($presentExpectedDirectories);

        return $this->expectedDirectories === $presentExpectedDirectories;
    }
1325560
private function mayServeStaleWhileRevalidate(Response $entry): bool
    {
        $timeout = $entry->headers->getCacheControlDirective('stale-while-revalidate');

        if (null === $timeout) {
            $timeout = $this->options['stale_while_revalidate'];
        }

        return abs($entry->getTtl()) < $timeout;
    }
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;
    }
302843
public function containsFolder( $dirName )
	{
		if( !$this->numFolders )
			return FALSE;
		foreach( $this->folders as $key => $information )
			if( $information['name'] == $dirName )
				return TRUE;
	}
1050490
public static function isDirCS($sDir)
    {
        if (array_key_exists($sDir, static::$aIsDirCache)) {
            return static::$aIsDirCache[$sDir];
        }

        $aDirBits = explode(DIRECTORY_SEPARATOR, $sDir);
        $bResult  = true;
        while (count($aDirBits) > 1) {
            $sDirectory     = array_pop($aDirBits);
            $sDirectoryPath = implode(DIRECTORY_SEPARATOR, $aDirBits);
            $aDirectories   = array_map(function ($sDirectory) {
                return basename($sDirectory);
            }, glob($sDirectoryPath . DIRECTORY_SEPARATOR . '*', GLOB_NOSORT | GLOB_ONLYDIR));

            if (!in_array($sDirectory, $aDirectories)) {
                $bResult = false;
                break;
            }
        }

        static::$aIsDirCache[$sDir] = $bResult;
        return $bResult;
    }
230192
public function remove ($entry) {
		foreach ($this->data as $k => $v) {
			if ($v === $entry) {
				$associative = $this->isAssociative ();

				unset ($this->data[$k]);
				if ($associative) {
					$this->data = array_values ($this->data);
				}

				return true;

			}
		}
		return false;
	}