private function processFunctions(
        array $advisors,
        StreamMetaData $metadata,
        ReflectionFileNamespace $namespace
    ): bool {
        static $cacheDirSuffix = '/_functions/';

        $wasProcessedFunctions = false;
        $functionAdvices = $this->adviceMatcher->getAdvicesForFunctions($namespace, $advisors);
        $cacheDir        = $this->cachePathManager->getCacheDir();
        if (!empty($functionAdvices)) {
            $cacheDir .= $cacheDirSuffix;
            $fileName = str_replace('\\', '/', $namespace->getName()) . '.php';

            $functionFileName = $cacheDir . $fileName;
            if (!file_exists($functionFileName) || !$this->container->isFresh(filemtime($functionFileName))) {
                $functionAdvices = AbstractJoinpoint::flatAndSortAdvices($functionAdvices);
                $dirname         = dirname($functionFileName);
                if (!file_exists($dirname)) {
                    mkdir($dirname, $this->options['cacheFileMode'], true);
                }
                $generator = new FunctionProxyGenerator($namespace, $functionAdvices, $this->useParameterWidening);
                file_put_contents($functionFileName, $generator->generate(), LOCK_EX);
                // For cache files we don't want executable bits by default
                chmod($functionFileName, $this->options['cacheFileMode'] & (~0111));
            }
            $content = 'include_once AOP_CACHE_DIR . ' . var_export($cacheDirSuffix . $fileName, true) . ';';

            $lastTokenPosition = $namespace->getLastTokenPosition();
            $metadata->tokenStream[$lastTokenPosition][1] .= PHP_EOL . $content;
            $wasProcessedFunctions = true;
        }

        return $wasProcessedFunctions;
    }