@param  string  $fq_classlike_name_lc
@param  string|null  $file_path
@psalm-suppress MixedAssignment

@return ClassLikeStorage|null
505508
private function loadFromCache($fq_classlike_name_lc, $file_path)
    {
        $cache_location = $this->getCacheLocationForClass($fq_classlike_name_lc, $file_path);

        if (file_exists($cache_location)) {
            if ($this->config->use_igbinary) {
                $storage = igbinary_unserialize((string)file_get_contents($cache_location));

                if ($storage instanceof ClassLikeStorage) {
                    return $storage;
                }

                return null;
            }

            $storage = unserialize((string)file_get_contents($cache_location));

            if ($storage instanceof ClassLikeStorage) {
                return $storage;
            }

            return null;
        }

        return null;
    }
496717
def get_qual(fastafile, suffix=QUALSUFFIX, check=True):
    
    qualfile1 = fastafile.rsplit(".", 1)[0] + suffix
    qualfile2 = fastafile + suffix

    if check:
        if op.exists(qualfile1):
            logging.debug("qual file `{0}` found".format(qualfile1))
            return qualfile1
        elif op.exists(qualfile2):
            logging.debug("qual file `{0}` found".format(qualfile2))
            return qualfile2
        else:
            logging.warning("qual file not found")
            return None

    return qualfile1
398145
public function getReportingLevelForClass($issue_type, $fq_classlike_name)
    {
        if (isset($this->issue_handlers[$issue_type])) {
            return $this->issue_handlers[$issue_type]->getReportingLevelForClass($fq_classlike_name);
        }
    }
1171915
private function loadFromCache($file_path)
    {
        $cache_location = $this->getCacheLocationForPath($file_path);

        if (file_exists($cache_location)) {
            if ($this->config->use_igbinary) {
                $storage = igbinary_unserialize((string)file_get_contents($cache_location));

                if ($storage instanceof FileStorage) {
                    return $storage;
                }

                return null;
            }

            $storage = unserialize((string)file_get_contents($cache_location));

            if ($storage instanceof FileStorage) {
                return $storage;
            }

            return null;
        }

        return null;
    }
71437
public function load($pluginFqcn, $pluginPath = null)
    {
        if (!$pluginPath) {
            $rPlugin = new \ReflectionClass($pluginFqcn);
            $pluginPath = $rPlugin->getFileName();
        }

        if (!file_exists($pluginPath)) {
            throw new RuntimeException(
                "No bundle class file matches the FQCN '{$pluginFqcn}' "
                .'(expected path was : '.$pluginPath.')',
                self::NO_PLUGIN_FOUND
            );
        }

        return $this->getPluginInstance($pluginPath, $pluginFqcn);
    }
509770
private function getCacheLocationForClass($fq_classlike_name_lc, $file_path, $create_directory = false)
    {
        $root_cache_directory = $this->config->getCacheDirectory();

        if (!$root_cache_directory) {
            throw new \UnexpectedValueException('No cache directory defined');
        }

        $parser_cache_directory = $root_cache_directory . DIRECTORY_SEPARATOR . self::CLASS_CACHE_DIRECTORY;

        if ($create_directory && !is_dir($parser_cache_directory)) {
            mkdir($parser_cache_directory, 0777, true);
        }

        return $parser_cache_directory
            . DIRECTORY_SEPARATOR
            . sha1(($file_path ? strtolower($file_path) . ' ' : '') . $fq_classlike_name_lc)
            . ($this->config->use_igbinary ? '-igbinary' : '');
    }
1141673
public static String getStringWithFilePathOrClasspath(
            String filePathOrClasspath, String charsetName) {
        return getStringAsOptWithFilePath(filePathOrClasspath, charsetName)
                .orElseGet(
                        () -> getStringAsOptWithClasspath(
                                filePathOrClasspath,
                                charsetName).orElse(null));
    }
327708
public function classOrInterfaceExists($fq_class_name, CodeLocation $code_location = null)
    {
        return $this->classlikes->classOrInterfaceExists($fq_class_name, $code_location);
    }
224382
public static final CClassLoader getLoader(final String fpath) {
		String path = fpath;
		CClassLoader currentLoader = CClassLoader.rootLoader;

		if (path == null) {
			return CClassLoader.getRootLoader();
		}

		if (path.startsWith(CClassLoader.ROOT_LOADER)) {
			path = path.substring(10);
		}

		final StringTokenizer tokenizer = new StringTokenizer(path, "/", false);

		while (tokenizer.hasMoreTokens()) {
			final String name = tokenizer.nextToken();
			currentLoader = currentLoader.getLoaderByName(name);
		}

		return currentLoader;
	}
814164
public static function getClassFromFile($path_to_file)
    {
        //Grab the contents of the file
        $contents = file_get_contents($path_to_file);

        //Start with a blank namespace and class
        $namespace = $class = '';

        //Set helper values to know that we have found the namespace/class token and need to collect the string values after them
        $getting_namespace = $getting_class = false;

        //Go through each token and evaluate it as necessary
        foreach (token_get_all($contents) as $token) {
            //If this token is the namespace declaring, then flag that the next tokens will be the namespace name
            if (is_array($token) && T_NAMESPACE == $token[0]) {
                $getting_namespace = true;
            }

            //If this token is the class declaring, then flag that the next tokens will be the class name
            if (is_array($token) && T_CLASS == $token[0]) {
                $getting_class = true;
            }

            //While we're grabbing the namespace name...
            if (true === $getting_namespace) {
                //If the token is a string or the namespace separator...
                if (is_array($token) && in_array($token[0], [T_STRING, T_NS_SEPARATOR])) {
                    //Append the token's value to the name of the namespace
                    $namespace .= $token[1];
                } elseif (';' === $token) {
                    //If the token is the semicolon, then we're done with the namespace declaration
                    $getting_namespace = false;
                }
            }

            //While we're grabbing the class name...
            if (true === $getting_class) {
                //If the token is a string, it's the name of the class
                if (is_array($token) && T_STRING == $token[0]) {
                    //Store the token's value as the class name
                    $class = $token[1];

                    //Got what we need, stope here
                    break;
                }
            }
        }

        //Build the fully-qualified class name and return it
        return $namespace ? $namespace.'\\'.$class : $class;
    }
792884
public function get_file_info($component, $filearea, $itemid, $filepath, $filename) {
        // try to emulate require_login() tests here
        if (!isloggedin()) {
            return null;
        }

        $coursecontext = $this->context->get_course_context(true);
        if (!$this->course->visible and !has_capability('moodle/course:viewhiddencourses', $coursecontext)) {
            return null;
        }

        if (!is_viewing($this->context) and !$this->browser->is_enrolled($this->course->id)) {
            // no peaking here if not enrolled or inspector
            return null;
        }

        if (!$this->cm->uservisible) {
            // activity hidden sorry
            return null;
        }

        if (empty($component)) {
            return $this;
        }

        if ($component == 'mod_'.$this->modname and $filearea === 'intro') {
            return $this->get_area_intro($itemid, $filepath, $filename);
        } else if ($component == 'backup' and $filearea === 'activity') {
            return $this->get_area_backup($itemid, $filepath, $filename);
        }

        if ($functionname = component_callback_exists('mod_'.$this->modname, 'get_file_info')) {
            $cm = $this->cm->get_course_module_record();
            return $functionname($this->browser, $this->areas, $this->course, $cm,
                $this->context, $filearea, $itemid, $filepath, $filename);
        }

        return null;
    }
1004378
public static function ExtractVendorRootDir ($class_name = null, $dir_path = __DIR__) {
		$dir = str_replace("\\", '/', __DIR__);
		if (substr($dir, 0, 7) === 'phar://') {
			$dir = preg_replace("@(^|/)(.+)\.phar(?:\.[^/]+)*(/|$)@", '$1$2$3', substr($dir, 7));
		}
		return sprintf('%s/', mb_substr($dir, 0, mb_strlen(str_replace("\\", '/', __NAMESPACE__)) * -1 - 1));
	}
948418
public static function LoadCache ($ini_path, $cache_file_path) {
		clearstatcache(false, $cache_file_path);
		clearstatcache(false, $ini_path);
		return file_exists($cache_file_path) && filemtime($cache_file_path) < filemtime($ini_path) ? include $cache_file_path : null;
	}
470555
public static function getClassesForFile(Codebase $codebase, $file_path)
    {
        try {
            return $codebase->file_storage_provider->get($file_path)->classlikes_in_file;
        } catch (\InvalidArgumentException $e) {
            return [];
        }
    }
1241168
protected Logic instantiateLogic (String path, String lclass) {
        try {
            Class<?> pcl = Class.forName(lclass);
            return (Logic)pcl.newInstance();
        } catch (ClassNotFoundException cnfe) {
            // nothing interesting to report
        } catch (Throwable t) {
            log.warning("Unable to instantiate logic for application", "path", path,
                        "lclass", lclass, t);
        }
        return null;
    }
301410
private File findFile(String fileName, List path)
    {
        final String methodName = "findFile(): ";
        String fileSeparator = System.getProperty("file.separator");
        for (Iterator i = path.iterator(); i.hasNext();)
        {
            String directory = (String) i.next();
            if (!directory.endsWith(fileSeparator) && !fileName.startsWith(fileSeparator))
            {
                directory = directory + fileSeparator;
            }
            File file = new File(directory + fileName);
            if (log.isDebugEnabled())
            {
                log.debug(methodName + " checking '" + file.getAbsolutePath() + "'");
            }
            if (file.exists() && file.canRead())
            {
                log.debug(methodName + " found it - file is '" + file.getAbsolutePath() + "'");
                cache.put(fileName, new CacheEntry(file));
                return file;
            }
        }
        return null;
    }
1290741
public function get($fq_classlike_name)
    {
        $fq_classlike_name_lc = strtolower($fq_classlike_name);

        if (!isset(self::$storage[$fq_classlike_name_lc])) {
            throw new \InvalidArgumentException('Could not get class storage for ' . $fq_classlike_name);
        }

        return self::$storage[$fq_classlike_name_lc];
    }