public function mutateProjectFiles(Project $project)
    {
        /** @var ContentRendererFactory $contentRenderers */
        $contentRenderers = $project->get('content_renderers');

        foreach (array_keys($this->getFileList()) as $fileKey) {
            /** @var File $file */
            if (! $file = $project->get('files.'.$fileKey)) {
                continue;
            }

            $file->setData(['content_type' => $this->name]);

            if ($this->permalink !== '*') {
                $file->setPermalink(new Permalink($this->permalink));
            }

            // If we are not a default Content Type
            $templatePath = $project->sourceDirectory.DIRECTORY_SEPARATOR.'_views'.DIRECTORY_SEPARATOR.$this->template.'.phtml';
            if ($this->template !== 'default' && file_exists($templatePath)) {
                $fileRenderer = $contentRenderers->get($file->getExt());
                $file->setData(['content' => $fileRenderer->render($file)]);
                $file->setFileInfo(new SplFileInfo($templatePath, '_views', '_views'.DIRECTORY_SEPARATOR.$this->template.'.phtml'));

                if ($fileRenderer->supportsFrontMatter()) {
                    $frontMatter = new FrontMatter($file->getFileContent());
                    $file->setData(array_merge_recursive($file->getData(), $frontMatter->getData()));
                    $file->setContent($frontMatter->getContent());
                } else {
                    $file->setContent($file->getFileContent());
                }

                if ($file->hasData('generator')) {
                    $project->replaceFile($file, new FileGenerator($file));
                }
            }
        }
    }