Returns TRUE if the file should be included in the results. This can be
overloaded to customise functionality, or extended via callbacks.

@param string $basename
@param string $pathname
@param int $depth
@return bool
195157
protected function acceptFile($basename, $pathname, $depth)
    {
        if ($regex = $this->getOption('name_regex')) {
            if (!preg_match($regex, $basename)) {
                return false;
            }
        }

        if ($ignore = $this->getOption('ignore_files')) {
            if (in_array($basename, $ignore)) {
                return false;
            }
        }

        if ($minDepth = $this->getOption('min_depth')) {
            if ($depth < $minDepth) {
                return false;
            }
        }

        if ($callback = $this->getOption('accept_callback')) {
            if (!call_user_func($callback, $basename, $pathname, $depth)) {
                return false;
            }
        }

        if ($callback = $this->getOption('accept_file_callback')) {
            if (!call_user_func($callback, $basename, $pathname, $depth)) {
                return false;
            }
        }

        return true;
    }
762472
def _is_path_excluded(self, path):
        
        exclude = self._exclude
        if not exclude:
            return False
        basename = os.path.basename(path)
        if self._fnmatch(basename, exclude):
            return True

        absolute_path = os.path.abspath(path)
        match = self._fnmatch(absolute_path, exclude)
        return match
572902
public function isIncludedRelationship(
        string $baseRelationshipPath,
        string $relationshipName,
        array $defaultRelationships
    ): bool {
        if ($this->includedRelationships === null) {
            $this->setIncludedRelationships();
        }

        if ($this->getQueryParam("include") === "") {
            return false;
        }

        if (empty($this->includedRelationships) && array_key_exists($relationshipName, $defaultRelationships)) {
            return true;
        }

        return isset($this->includedRelationships[$baseRelationshipPath][$relationshipName]);
    }
691601
public static boolean containsFile(final File fileToSearch, final String pathname)
	{
		final String[] allFiles = fileToSearch.list();
		if (allFiles == null)
		{
			return false;
		}
		final List<String> list = Arrays.asList(allFiles);
		return list.contains(pathname);
	}
1015097
protected function verifyDirectoryExistence($base, $cacheDir)
    {
        if (is_dir("$base/$cacheDir")) {
            return;
        }

        $folder_path = explode('/', $cacheDir);
        foreach ($folder_path as $element) {
            $base .= '/' . $element;
            if (!is_dir($base)) {
                mkdir($base, 0755, true);
                chmod($base, 0755);
            }
        }
    }
754938
protected function isSectionExcluded(string $sectionName, array $sectionDefinition): bool
    {
        if ($this->isExcludedByName($sectionName)) {
            return true;
        }

        if ($this->isExcludedByDefinition($sectionDefinition) && !$this->shouldBeIncluded($sectionName)) {
            return true;
        }

        return false;
    }
1316030
public function scopeWhereBasename(Builder $q, $basename)
    {
        $q->where('filename', pathinfo($basename, PATHINFO_FILENAME))
            ->where('extension', pathinfo($basename, PATHINFO_EXTENSION));
    }
566607
public static function mkdirs($pathname, $mode = 0755)
    {
        is_dir(dirname($pathname)) || self::mkdirs(dirname($pathname), $mode);
        return is_dir($pathname) || @mkdir($pathname, $mode); // @codingStandardsIgnoreLine
    }
642433
public function isInclude($fieldName)
    {
        if ($this->hasField($fieldName) === false) {
            return false;
        }

        $class = __CLASS__;

        return ($this->mapping[$fieldName]['include'] instanceof $class);
    }
1146443
protected function isExcludedFromDb($basename)
    {
        if (in_array(mb_strtolower($basename), $this->excludeFromDb)) {
            return true;
        }

        return Helper::startsWith($basename, '.') || Helper::startsWith($basename, '_');

    }
520570
protected function isCached($filename)
    {
        if (! empty($this->cacheDir)) {
            return false;
        }

        $cacheFile = $this->cacheDir . DIRECTORY_SEPARATOR . $filename . ".cache";

        if (file_exists($cacheFile)
            && is_array($this->cacheContent = include($cacheFile))
            && $this->cacheContent["_chk"] == filemtime($cacheFile)
        ) {
            return true;
        }

        return false;
    }
1072281
private String[] readIncludeFiles(final String filename, final int depth) {
    logger.info("In readIncludeFiles() for filename='" + filename + "' depth=" + depth);
    if (depth > 10) { // 10 seems like a nice limit... If we're this deep, we're
      // probably in an infinite loop anyway.
      logger.log(Logging.Priority.ERROR.getLevel(), "readIncludeFiles(): Too deep to continue including (depth=" + depth + "). Ending this branch at: " + filename);
      return new String[0];
    }
    final List<String> filenames = new ArrayList<String>();
    java.io.InputStream in = null;
    try {
      final List<InputStream> ioStreams = getInputStreamsForFile(filename);

      for (int i = 0; i < ioStreams.size(); i++) {
        try {
          in = ioStreams.get(i);

          int currentChar = in.read();
          String currentLine = "";
          while (currentChar != -1) {
            if (currentChar == '\r' || currentChar == '\n') {
              if (currentLine.indexOf("#include ") == 0) {
                final String includeFile = replaceVariables(currentLine.substring(9));
                if (includeFile.equals("false")) {
                  logger.info("Found '#include false': Cancelling include processing for this file.");
                  return new String[0];
                }
                logger.info("Found: " + currentLine + ", adding include of '" + includeFile + "' from file='" + filename + "'");
                filenames.add(includeFile);
              }
              currentLine = "";
            } else {
              final byte temp[] = new byte[1];
              temp[0] = (byte) currentChar;
              currentLine += new String(temp, 0, 1);
            }
            currentChar = in.read();
          }
        }
        catch (final java.io.IOException ex) {
          logger.log(Logging.Priority.ERROR.getLevel(), "Unable to read property file to parse include files (" + filename + "): ", ex);
        }
        finally {
          try {
            if (in != null) {
              in.close();
            }
          }
          catch (final java.io.IOException ignored) {
          }
        }
      }
    }
    catch (final java.io.IOException ex) {
      logger.log(Logging.Priority.ERROR.getLevel(), "Unable to read property file to parse include files (" + filename + "): ", ex);
    }
    return filenames.toArray(new String[filenames.size()]);
  }
704111
public function hasPath($moduleName, $dependency)
    {
        // does not exist in the graph
        if (!isset($this->dependencies[$moduleName])) {
            return false;
        }

        // adjacent node
        if (isset($this->dependencies[$moduleName][$dependency])) {
            return true;
        }

        // DFS
        foreach ($this->dependencies[$moduleName] as $predecessor => $_) {
            if ($this->hasPath($predecessor, $dependency)) {
                return true;
            }
        }

        return false;
    }
1169588
private boolean checkFilePath(String file, int depth) {
    // The file is either a node file or an edge file and needs to be stored at either:
    // flowGraphDir/nodeName/nodeName.properties (if it is a node file), or
    // flowGraphDir/nodeName/nodeName/edgeName.properties (if it is an edge file)

    Path filePath = new Path(file);
    String fileExtension = Files.getFileExtension(filePath.getName());
    if (filePath.depth() != depth || !checkFileLevelRelativeToRoot(filePath, depth)
        || !(this.javaPropsExtensions.contains(fileExtension))) {
      log.warn("Changed file does not conform to directory structure and file name format, skipping: "
          + filePath);
      return false;
    }
    return true;
  }
704882
public function load($baseName) 
    {     
        $langFile = "{$this->dir}/{$this->locale}/{$baseName}.php";

        if (!is_file($langFile)) {
            return $this->langs;
        }
        
        $langs = include_once $langFile;
        if ($langs && is_array($langs)) {
            $this->langs = array_merge_recursive($this->langs, $langs);
        }
        
        return $this->langs;
    }
1340536
public static function isCompiled( $compiledDir, $basename )
	{
		$extensions = array( 'json', 'zip' );
		// Make sure the dir ends in /
		$compiledDir = rtrim( $compiledDir, '/' ) . "/";

		foreach ( $extensions as $extension )
		{
			$compiledFile = "$compiledDir$basename.$extension";
			if ( ! file_exists( $compiledFile ) ) continue;
			return $compiledFile;
		}

		return false;
	}
1234135
private boolean matchesIncludes( final String fileName )
    {
        if( m_includes.length == 0 )
        {
            return true;
        }
        for( Pattern include : m_includes )
        {
            if( include.matcher( fileName ).matches() )
            {
                return true;
            }
        }
        return false;
    }