|
|
|
@ -15,6 +15,8 @@ use Symfony\Component\Filesystem\Filesystem;
|
|
|
|
|
*/ |
|
|
|
|
class PhpDocumentorConfigStage implements StageInterface |
|
|
|
|
{ |
|
|
|
|
const TOPNAV_SPIP = '//boussole.spip.net/?page=spipnav.js&lang=fr'; |
|
|
|
|
|
|
|
|
|
public function __invoke(Context $context): Context |
|
|
|
|
{ |
|
|
|
|
$context->add('stages', $this::class); |
|
|
|
@ -78,12 +80,18 @@ class PhpDocumentorConfigStage implements StageInterface
|
|
|
|
|
|
|
|
|
|
private function generateConfig(Context $context) { |
|
|
|
|
$template = new Template($context->directory->templates, $context->directory->config); |
|
|
|
|
$topnav = match (true) { |
|
|
|
|
!$context->empty('topnav_spip') => $this::TOPNAV_SPIP, |
|
|
|
|
!$context->empty('topnav') => $context->get('topnav'), |
|
|
|
|
default => null, |
|
|
|
|
}; |
|
|
|
|
$content = $template->render('phpdoc.xml.twig', [ |
|
|
|
|
'title' => $context->title, |
|
|
|
|
'presentation' => $context->presentation, |
|
|
|
|
'package' => $context->package, |
|
|
|
|
'directory' => $context->directory, |
|
|
|
|
'git' => $context->git, |
|
|
|
|
'topnav' => $topnav, |
|
|
|
|
]); |
|
|
|
|
$file = 'phpdoc_' . $context->package->prefix . '.xml'; |
|
|
|
|
$template->write($file, $content); |
|
|
|
|