Extracts the class name from a cache file
@return string
165742
protected function extractClassFromFile($path)
    {
        $fileContent = file_get_contents($path);
        $matches = [];
        $pattern = '/Cms\S+_\S+Class/';
        preg_match($pattern, $fileContent, $matches);

        if (!empty($matches[0])) {
            return $matches[0];
        }

        return null;
    }
1245950
protected function _getDefaultCacheConfigClassName()
    {
        $config = Cache::getConfig('default');
        $engine = (string)$config['className'];

        // short cache engine names can be returned immediately
        if (strpos($engine, '\\') === false) {
            return $engine;
        }
        // fully namespace cache engine names need extracting class name
        preg_match('/.+\\\\(.+)Engine/', $engine, $matches);

        return $matches[1];
    }
154772
protected function getClassName(File $phpCsFile): string
    {
        $fileName = $phpCsFile->getFilename();
        $fileNameParts = explode(DIRECTORY_SEPARATOR, $fileName);
        $sourceDirectoryPosition = array_search('src', array_values($fileNameParts));
        $classNameParts = array_slice($fileNameParts, $sourceDirectoryPosition + 1);
        $className = implode('\\', $classNameParts);
        $className = str_replace('.php', '', $className);

        return $className;
    }
1352139
public function getCachePath(): string
    {
        $path = $this->getRuntimePath() . DIRECTORY_SEPARATOR . 'cache';
        FileHelper::createDirectory($path);
        return $path;
    }
509373
private function getCache()
    {
        // cache for single run
        // so that getLastModified and getContent in single request do not add additional cache roundtrips (i.e memcache)
        if (isset($this->parsed)) {
            return $this->parsed;
        }

        // check from cache first
        $cache = null;
        $cacheId = $this->getCacheId();
        if ($this->cache->isValid($cacheId, 0)) {
            if ($cache = $this->cache->fetch($cacheId)) {
                $cache = unserialize($cache);
            }
        }

        $less = $this->getCompiler();
        $input = $cache ? $cache : $this->filepath;
        $cache = $less->cachedCompile($input);

        if (!is_array($input) || $cache['updated'] > $input['updated']) {
            $cache['lastModified'] = $this->getMaxLastModified($cache);
            $this->cache->store($cacheId, serialize($cache));
        }

        return $this->parsed = $cache;
    }
437336
public function getCacheFile()
    {
        if (!isset($this->filenames[$this->settings['name']])) {
            if ($this->checkCacheDir()) {
                $filename = preg_replace('/[^0-9a-z\.\_\-]/i', '', strtolower($this->settings['name']));
                $this->filenames[$this->settings['name']] = $this->settings['path'] .
                    sha1($filename) .
                    $this->settings['extension'];
            }
        }
        return $this->filenames[$this->settings['name']];
    }
935194
public function name(): string
    {
        static $name = null;
        if ($name === null) {
            // Extract command name from the class name.
            $class = substr(strrchr(static::class, '\\'), 1);
            $name = CommandLoader::inverseTranslate($class);
        }

        return $name;
    }
639552
public function getCacheTag()
    {
        return $this->cacheTagPrefix .
            ($this->isAttributeChanged($this->idAttribute) ? $this->getOldAttribute($this->idAttribute) : $this->getID());
    }
612437
public function key(): string
    {
        if ($this->cacheFilesIterator === null) {
            $this->rewind();
        }
        return $this->cacheFilesIterator->getBasename($this->cacheEntryFileExtension);
    }
1176882
public function getNamespace($class_name)
	{
		$class_name = trim($class_name, '\\');
		if ($last_separator = strrpos($class_name, '\\'))
		{
			return substr($class_name, 0, $last_separator + 1);
		}
		return '';
	}
372627
public function getCacheDir()
    {
        $dir=$this->m_cacheDir;
        if(empty($dir)){
            $dir=__DIR__."/../../../../../../_cache";
        }
        if(!file_exists($dir)){
            File::createDir($dir);
        }
        return rtrim($dir)."/";
    }
1067499
public function cacheDetectedFaceFilename() {
			$folder = $this->owner->ParentID ? $this->owner->Parent()->Filename : ASSETS_DIR . "/";

			$format = 'DetectedFace';

			if($this->owner instanceof SecureImage){
				$file = pathinfo($this->owner->Name);
				return $folder . "_resampled/".md5($format."-".$file['filename']).".".$file['extension'];
			}else{
				return $folder . "_resampled/".$format."-".$this->owner->Name;
			}
		}
470595
public function getName(): string
    {
        // Check cache.
        if (null === $this->name) {
            $tokens = $this->getTokenStream();
            // Find class token
            try {
                $loc = $tokens->scan(0, [T_CLASS, T_TRAIT]);
            } catch (\OutOfBoundsException $e) {
                throw new ClassDefinitionNotFoundException('No class is found inside ' . $this->filename . '.', 0, $e);
            }

            // Get the following token
            if ($loc !== null) {
                $loc = $tokens->next($loc);
            }

            // Make sure it is not :: but a name
            if ($loc !== null && $tokens->type($loc) === T_STRING) {
                // Read the name from the token
                $this->name           = $tokens->value($loc);
                $this->class_location = $loc;
            } else {
                // Mark the name as NOT found (in contrast to not initialized)
                $this->name = false;
            }
        }

        // Return the name if a class was found or throw an exception.
        if ($this->name) {
            return $this->name;
        }

        throw new ClassDefinitionNotFoundException('No class is found inside ' . $this->filename . '.');
    }
675275
protected static function _getConfig() {
        if (null === self::$_classConfigCacheEnabled) {
            self::$_classConfigCacheEnabled = CM_Config::get()->classConfigCacheEnabled;
        }

        $calledClass = get_called_class();
        $cacheKey = CM_CacheConst::ClassConfig . '_className:' . $calledClass;
        $cache = new CM_Cache_Storage_Apc();
        if (!self::$_classConfigCacheEnabled || !isset(self::$_classConfigList[$calledClass])) {
            if (!self::$_classConfigCacheEnabled || false === ($result = $cache->get($cacheKey))) {
                $result = self::_getConfigRaw();
                if (self::$_classConfigCacheEnabled) {
                    $cache->set($cacheKey, $result);
                }
            }
            self::$_classConfigList[$calledClass] = $result;
        }

        return self::$_classConfigList[$calledClass];
    }
1071348
public function getClassMap() {
		if ($this->classMap) {
			return $this->classMap;
		}

		if ($this->useCache) {
			// Cache duration: 30 minutes.
			$this->classMap = $this->cacheService->get("mouf.classMap.".__DIR__."/".json_encode($this->selfEdit));
			if ($this->classMap != null) {
				return $this->classMap;
			}
		}
		
		$this->analyze();
		return $this->classMap;
	}
197585
public function getClass($class)
    {
        $cacheKey = self::CACHE_KEY_CLASSES . strtolower($class);

        if (! $reflectionClass = $this->cache->fetch($cacheKey)) {
            $reflectionClass = new ReflectionClass($class);
            $this->cache->store($cacheKey, $reflectionClass);
        }

        return $reflectionClass;
    }
1020040
public function getClassName()
    {
        return ($this->tableName() === null) ? self::pluralize(self::stripclassName()) : $this->tableName();
    }