Browse Source

Migration vers phpDocumentor 2.6.1

Nombreuses adaptations :


1) les binaires sont maintenant sans extension .php


2) Pour tenir compte des <options> que l'ont passait dans phpdoc.xml, spécifique à l'autodoc,
il faut grandement ruser maintenant car le sérialiseur / désérialiseur utilisé maintenant par phpdocumentor
ne conserve que les éléments qui lui sont déclarés. Pour cela, on surcharge donc la classe Configuration
de phpdocumentor pour ajouter notre tableau d'options. 

À noter que la syntaxe est légèrement différente (voir Helpers/phpdoc_helper.xml)


3) Pour faire parvenir les données de configuration au template Twig, et suite toujours au
changement dans la gestion de la configuration de phpdocumentor, on transmet directement
aux template la configuration connue (sans la recalculer). Mais pour cela, on doit
surcharger le Writer/Twig pour ajouter notre élément. La surcharge est minime heureusement.


4) L'autoloader est déclaré différemment également. Il est appelé avant le chargement de phpDocumentor 
et lui est transmis lors de la création (new Application(...)). On s'adapte (dans bin/autodoc) et on
adapte toutes les commandes Helpers pour transmettre cet autoloader… Pfiou.

Du coup, pour simplifier un peu, on crée une Application pour le Helpers, et on déporte 
de bin/autodoc_helper vers l'application la déclaration des commandes utilisables.
svn/root/trunk
marcimat@rezo.net 8 years ago
parent
commit
05ad9a1a02
  1. 9
      .gitattributes
  2. 29
      bin/autodoc
  3. 17
      bin/autodoc.php
  4. 19
      bin/autodoc_helper
  5. 6
      composer.json
  6. 66
      src/autodoc/Application.php
  7. 45
      src/autodoc/Configuration.php
  8. 59
      src/autodoc/Configuration/Option.php
  9. 60
      src/autodoc/Configuration/Options.php
  10. 43
      src/autodoc/Helpers/Application.php
  11. 2
      src/autodoc/Helpers/Command/FromDirectory.php
  12. 2
      src/autodoc/Helpers/Command/FromFile.php
  13. 2
      src/autodoc/Helpers/Command/FromPlugin.php
  14. 2
      src/autodoc/Helpers/Command/FromSpip.php
  15. 2
      src/autodoc/Helpers/Command/FromSvn.php
  16. 2
      src/autodoc/Helpers/Command/FromZone.php
  17. 26
      src/autodoc/Helpers/Generator.php
  18. 12
      src/autodoc/Helpers/phpdoc_helper.xml
  19. 2
      src/autodoc/Plugin/Core/Compiler/Pass/GetTopNav.php
  20. 5
      src/autodoc/Plugin/Core/Descriptor/Interfaces/DirectoryInterface.php
  21. 25
      src/autodoc/Plugin/Core/ServiceProvider.php
  22. 52
      src/autodoc/Plugin/Core/Transformer/Writer/Twig.php
  23. 38
      src/autodoc/Plugin/Core/TwigZora.php
  24. 3
      templates/zora/footer/dist.twig
  25. 2
      templates/zora/template.xml

9
.gitattributes vendored

@ -1,9 +1,13 @@
* text=auto !eol
bin/autodoc.php -text
bin/autodoc_helper.php -text
bin/autodoc -text
bin/autodoc_helper -text
/composer.json -text
/installation.md -text
src/autodoc/Application.php -text
src/autodoc/Configuration.php -text
src/autodoc/Configuration/Option.php -text
src/autodoc/Configuration/Options.php -text
src/autodoc/Helpers/Application.php -text
src/autodoc/Helpers/Command/FromDirectory.php -text
src/autodoc/Helpers/Command/FromFile.php -text
src/autodoc/Helpers/Command/FromPlugin.php -text
@ -48,6 +52,7 @@ src/autodoc/Plugin/Core/Transformer/Router/UrlGenerator/Zora/ProjectDescriptor.p
src/autodoc/Plugin/Core/Transformer/Router/ZoraRouter.php -text
src/autodoc/Plugin/Core/Transformer/Writer/FileCleaner.php -text
src/autodoc/Plugin/Core/Transformer/Writer/FileConcat.php -text
src/autodoc/Plugin/Core/Transformer/Writer/Twig.php -text
src/autodoc/Plugin/Core/TwigZora.php -text
templates/zora/api.twig -text
templates/zora/apis.twig -text

29
bin/autodoc

@ -0,0 +1,29 @@
#!/usr/bin/env php
<?php
/**
* Autodoc.
*
* phpDocumentor pour le code source de SPIP
*
* Cet exécutable charge l'application autodoc (= phpdocumentor + plugins pour SPIP)
* et utilise les mêmes arguments d'entrée que l'application phpDocumentor.
*
* Pour un usage simplifié, utiliser autodoc_helper.php
*/
# charger l'autoloader
$bootstrap_folder = __DIR__ . '/../src';
$autoloader_base_path = '/../vendor/autoload.php';
$autoloader_location = $bootstrap_folder . $autoloader_base_path;
if (! file_exists($autoloader_location) || ! is_readable($autoloader_location)) {
throw new \RuntimeException('Unable to find autoloader at ' . $autoloader_location);
}
$autoloader = require $autoloader_location;
$app = new autodoc\Application($autoloader);
$app->run();

17
bin/autodoc.php

@ -1,17 +0,0 @@
#!/usr/bin/env php
<?php
/**
* Autodoc.
*
* phpDocumentor pour le code source de SPIP
*
* Cet exécutable charge l'application autodoc (= phpdocumentor + plugins pour SPIP)
* et utilise les mêmes arguments d'entrée que l'application phpDocumentor.
*
* Pour un usage simplifié, utiliser autodoc_helper.php
*/
require_once __DIR__ . '/../src/autodoc/Application.php';
$app = new autodoc\Application();
$app->run();

19
bin/autodoc_helper.php → bin/autodoc_helper

@ -13,14 +13,17 @@
*/
# charger l'autoloader
require_once __DIR__ . '/../src/autodoc/Application.php';
$bootstrap_folder = __DIR__ . '/../src';
$autoloader_base_path = '/../vendor/autoload.php';
$autoloader_location = $bootstrap_folder . $autoloader_base_path;
if (! file_exists($autoloader_location) || ! is_readable($autoloader_location)) {
throw new \RuntimeException('Unable to find autoloader at ' . $autoloader_location);
}
$autoloader = require $autoloader_location;
# exécuter l'application
$app = new \Cilex\Application('Autodoc Generator Helper', '1.0.0');
$app->command(new autodoc\Helpers\Command\FromSpip());
$app->command(new autodoc\Helpers\Command\FromPlugin());
$app->command(new autodoc\Helpers\Command\FromZone());
$app->command(new autodoc\Helpers\Command\FromSvn());
$app->command(new autodoc\Helpers\Command\FromDirectory());
$app->command(new autodoc\Helpers\Command\FromFile());
$app = new autodoc\Helpers\Application($autoloader);
$app->run();

6
composer.json

@ -6,7 +6,9 @@
}
},
"require": {
"php": ">=5.3.3",
"phpdocumentor/phpdocumentor": "2.*"
"php": ">=5.3.3"
},
"require-dev": {
"phpdocumentor/phpdocumentor": "dev-develop"
}
}

66
src/autodoc/Application.php

@ -7,12 +7,7 @@ namespace autodoc;
use phpDocumentor\Application as phpDocumentor;
use phpDocumentor\Console\Output\Output as ConsoleOutput;
use Symfony\Component\Console\Input\StringInput;
/**
* Finds and activates the autoloader.
*/
require_once findAutoloader();
/**
* Application class for phpDocumentor.
@ -25,9 +20,9 @@ class Application extends phpDocumentor
/**
* Initializes all components used by phpDocumentor.
*/
public function __construct()
public function __construct($autoloader = null)
{
parent::__construct();
parent::__construct($autoloader);
$this['console.output'] = $this->share(
function ($app) {
@ -87,62 +82,5 @@ class Application extends phpDocumentor
$output->write(sprintf('%-68.68s .. ', "Total time for this directory"));
$output->writeln(sprintf('%8.3fs', microtime(true) - $timerStart));
}
/**
* Run the application with command as string
*
* @example
* $app->run_with_command("project:run --config=phpdoc.xml");
*
* @param bool $interactive Whether to run in interactive mode.
*
* @return void
*/
public function run_with_command($command = "")
{
$timerStart = microtime(true);
/** @var ConsoleApplication $app */
$app = $this['console'];
$app->setAutoExit(false);
$output = new ConsoleOutput();
$output->setLogger($this['monolog']);
$app->run(new StringInput($command), $output);
$output->writeln(sprintf("%-'-81s", ""));
$output->write(sprintf('%-68.68s .. ', "Total time for this directory"));
$output->writeln(sprintf('%8.3fs', microtime(true) - $timerStart));
}
}
/**
* Tries to find the autoloader relative to this file and return its path.
*
* @author Mike van Riel / Naenius (http://www.naenius.com)
*
* @throws \RuntimeException if the autoloader could not be found.
*
* @return string the path of the autoloader.
*/
function findAutoloader()
{
$autoloader_base_path = '/../../vendor/autoload.php';
// if the file does not exist from a base path it is included as vendor
$autoloader_location = file_exists(__DIR__ . $autoloader_base_path)
? __DIR__ . $autoloader_base_path
: __DIR__ . '/../../..' . $autoloader_base_path;
if (!file_exists($autoloader_location)) {
throw new \RuntimeException(
'Unable to find autoloader at ' . $autoloader_location
);
}
return $autoloader_location;
}

45
src/autodoc/Configuration.php

@ -0,0 +1,45 @@
<?php
/**
* autodoc
*/
namespace autodoc;
use JMS\Serializer\Annotation as Serializer;
use phpDocumentor\Configuration as phpDocumentorConfiguration;
use phpDocumentor\Configuration\Merger\Annotation as Merger;
use autodoc\Configuration\Options;
/**
* The definition for the configuration of autodoc.
*/
class Configuration extends phpDocumentorConfiguration
{
/**
* @var Options[] contains a list of options
* @Serializer\Type("autodoc\Configuration\Options")
*/
protected $options;
/**
* Initializes all settings with their default values.
*/
public function __construct()
{
parent::__construct();
$this->options = new Options();
}
/**
* Returns the configuration related to options for autodoc.
*
* @return autodoc\Configuration\Options
*/
public function getOptions()
{
return $this->options;
}
}

59
src/autodoc/Configuration/Option.php

@ -0,0 +1,59 @@
<?php
namespace autodoc\Configuration;
use JMS\Serializer\Annotation as Serializer;
/**
* Configuration object for an option
*/
class Option
{
/**
* @var string
*
* @Serializer\XmlAttribute
* @Serializer\Type("string")
*/
protected $name;
/**
* @var string
*
* @Serializer\XmlAttribute
* @Serializer\Type("string")
*/
protected $value;
/**
* Registers the option name and value
*
* @param string $name
* @param string $value
*/
public function __construct($name, $value)
{
$this->name = $name;
$this->value = $value;
}
/**
* Returns the option name.
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Returns the option value.
*
* @return string
*/
public function getValue()
{
return $this->value;
}
}

60
src/autodoc/Configuration/Options.php

@ -0,0 +1,60 @@
<?php
namespace autodoc\Configuration;
use JMS\Serializer\Annotation as Serializer;
use phpDocumentor\Configuration\Merger\Annotation as Merger;
/**
* Represents the settings in the phpdoc.xml related to options for autodoc
*/
class Options
{
/**
* @var Option[] a list of options for autodoc
*
* @Serializer\Type("array<autodoc\Configuration\Option>")
* @Serializer\XmlList(inline = true, entry = "option")
* @Merger\Replace
*/
protected $options;
/**
* Initializes this configuration directive with the required options.
*
* @param Option[] $options
*/
public function __construct($options = array())
{
$this->options = $options;
}
/**
* Returns a list of options.
*
* @return \Option[]
*/
public function getOptions()
{
return $this->options;
}
/**
* Returns an option value.
*
* @return \Option
*/
public function get($name)
{
foreach ($this->options as $option) {
if ($option->getName() == $name) {
return $option;
}
}
return null;
}
}

43
src/autodoc/Helpers/Application.php

@ -0,0 +1,43 @@
<?php
/**
* autodoc helper : aide à l'exécution de l'autodoc de spip
*
* Note: Surcharge de Cilex pour transmettre l'autoloader
*/
namespace autodoc\Helpers;
use Cilex\Application as Cilex;
/**
* Application class for autodoc helper.
*
* Can be used as bootstrap when the run method is not invoked.
*/
class Application extends Cilex
{
public static $VERSION = '1.0.0';
/**
* Registers the autoloader and necessary components.
*
* @param string $name Name for this application.
* @param string|null $version Version number for this application.
*/
public function __construct($autoloader = null)
{
parent::__construct('Autodoc Generator Helper', self::$VERSION);
$this['autoloader'] = $autoloader;
// liste des commandes
$this->command(new Command\FromSpip());
$this->command(new Command\FromPlugin());
$this->command(new Command\FromZone());
$this->command(new Command\FromSvn());
$this->command(new Command\FromDirectory());
$this->command(new Command\FromFile());
}
}

2
src/autodoc/Helpers/Command/FromDirectory.php

@ -36,7 +36,7 @@ class FromDirectory extends Command
$output->writeln("\nExécuter autodoc avec <info>$directory</info>.\n");
$generator = new Generator($input, $output);
$generator = new Generator($input, $output, $this->getApplication()->getService('autoloader'));
$generator->generateFromDirectory($directory);
}
}

2
src/autodoc/Helpers/Command/FromFile.php

@ -44,7 +44,7 @@ svn://zone.spip.org/spip-zone/_plugins_/champs_extras/core/trunk;cextras
$output->writeln("\nExécuter autodoc sur un fichier : <info>$file</info>.\n");
$generator = new Generator($input, $output);
$generator = new Generator($input, $output, $this->getApplication()->getService('autoloader'));
$generator->generateFromFile($file);
}
}

2
src/autodoc/Helpers/Command/FromPlugin.php

@ -37,7 +37,7 @@ class FromPlugin extends Command
$output->writeln("\nExécuter autodoc sur un plugin de la Zone depuis : <info>$chemin</info>.\n");
$generator = new Generator($input, $output);
$generator = new Generator($input, $output, $this->getApplication()->getService('autoloader'));
$generator->generateFromZone('_plugins_/' . $chemin);
}
}

2
src/autodoc/Helpers/Command/FromSpip.php

@ -40,7 +40,7 @@ class FromSpip extends Command
$output->writeln("\nExécuter autodoc sur le Core : <info>$chemin</info>.\n");
$generator = new Generator($input, $output);
$generator = new Generator($input, $output, $this->getApplication()->getService('autoloader'));
$generator->generateFromSpip($chemin);
}

2
src/autodoc/Helpers/Command/FromSvn.php

@ -37,7 +37,7 @@ class FromSvn extends Command
$output->writeln("\nExécuter autodoc avec <info>$source</info>.\n");
$generator = new Generator($input, $output);
$generator = new Generator($input, $output, $this->getApplication()->getService('autoloader'));
$generator->generateFromSvn($source);
}

2
src/autodoc/Helpers/Command/FromZone.php

@ -37,7 +37,7 @@ class FromZone extends Command
$output->writeln("\nExécuter autodoc sur la Zone depuis : <info>$chemin</info>.\n");
$generator = new Generator($input, $output);
$generator = new Generator($input, $output, $this->getApplication()->getService('autoloader'));
$generator->generateFromZone($chemin);
}
}

26
src/autodoc/Helpers/Generator.php

@ -7,8 +7,10 @@
namespace autodoc\Helpers;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\StringInput;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Output\OutputInterface;
use autodoc\Application;
use autodoc\Application as Autodoc;
/**
* Exécuter l'application…
@ -17,11 +19,12 @@ class Generator
{
private $input;
private $output;
private $autoloader;
private $dirs = array();
private $files = array();
private $svn = array(); // informations sur le dépot SVN
private $options = array('dirs' => array()); // forcer des répertoires en dehors des options de ligne de commande
private $options = array('dirs' => array()); // forcer des répertoires en dehors des options de ligne de commande
private $commands = array(); // forcer des commandes spécifiques à phpdocumentor
// les infos de plugins sont enregistrées dedans pour l'index.html de la commande generateFromFile()
@ -43,10 +46,11 @@ class Generator
* @param InputInterface $input
* @param OutputInterface $output
**/
public function __construct(InputInterface $input, OutputInterface $output)
public function __construct(InputInterface $input, OutputInterface $output, $autoloader = null)
{
$this->input = $input;
$this->output = $output;
$this->autoloader = $autoloader;
$this->setApplicationDirectories();
}
@ -831,7 +835,19 @@ class Generator
$command .= $title;
}
$app = new Application();
$app->run_with_command($command);
// l'option --config=x de phpdocumentor (contrairement aux autres) n'est lue que via ArgvInput.
// de la sorte, pour transmettre cette option, on crée l'argv qui va bien. Ce n'est pas très glorieux !
$command_helper = $_SERVER['argv'];
$command = new StringInput("autodoc $command");
// pas moyen d'obtenir le tableau adapté directement… on triche par une réflexion.
$reflectedCommand = new \ReflectionClass('Symfony\Component\Console\Input\ArgvInput');
$tokens = $reflectedCommand->getProperty('tokens');
$tokens->setAccessible(true);
$_SERVER['argv'] = $tokens->getValue($command);
$app = new Autodoc( $this->autoloader );
$app->run();
$_SERVER['argv'] = $command_helper;
}
}

12
src/autodoc/Helpers/phpdoc_helper.xml

@ -16,8 +16,8 @@
<files>
<directory>@DIR_INPUT@</directory>
<ignore-hidden>on</ignore-hidden>
<ignore-symlinks>on</ignore-symlinks>
<ignore-hidden>true</ignore-hidden>
<ignore-symlinks>true</ignore-symlinks>
<ignore>tmp/*</ignore>
<ignore>lang/*</ignore>
@ -58,12 +58,18 @@
</transformations>
<options>
<option name="titre" value="@OPT_TITRE@" />
<option name="description" value="@OPT_DESCRIPTION@" />
<option name="presentation" value="@OPT_PRESENTATION@" />
<option name="titre_onglets" value="@OPT_TITRE_ONGLETS@" />
<option name="site" value="@OPT_SITE@" />
<!--
<titre value="@OPT_TITRE@" />
<description value="@OPT_DESCRIPTION@" />
<presentation value="@OPT_PRESENTATION@" />
<titre_onglets value="@OPT_TITRE_ONGLETS@" />
<site value="@OPT_SITE@" />
<!--
<proposer value="oui" />
<chemin value="autodoc/" />
-->

2
src/autodoc/Plugin/Core/Compiler/Pass/GetTopNav.php

@ -50,7 +50,7 @@ class GetTopNav implements CompilerPassInterface
*/
public function execute(ProjectDescriptor $project)
{
$topnav = $this->app['config']['options']['topnav']['value'];
$topnav = $this->app['config']->getOptions()->get('topnav');
if (!$topnav) return;
$js = file_get_contents($topnav);

5
src/autodoc/Plugin/Core/Descriptor/Interfaces/DirectoryInterface.php

@ -6,10 +6,11 @@
namespace autodoc\Plugin\Core\Descriptor\Interfaces;
use phpDocumentor\Descriptor\Collection;
use phpDocumentor\Descriptor\Interfaces\BaseInterface;
use phpDocumentor\Descriptor\Interfaces\ElementInterface;
use phpDocumentor\Descriptor\Interfaces\TypeInterface;
interface DirectoryInterface extends BaseInterface
interface DirectoryInterface extends ElementInterface, TypeInterface
{
public function setFiles(Collection $files);

25
src/autodoc/Plugin/Core/ServiceProvider.php

@ -8,6 +8,7 @@
namespace autodoc\Plugin\Core;
use Cilex\Application;
use phpDocumentor\Configuration\Loader;
use autodoc\Plugin\Core\Transformer\Writer;
use autodoc\Plugin\Core\Transformer\Router;
use autodoc\Plugin\Core\Compiler\Pass\DirectoryTreeBuilder;
@ -32,6 +33,17 @@ class ServiceProvider implements \Cilex\ServiceProviderInterface
public function register(Application $app)
{
// Définir nos options de configuration supplémentaires contenues
// dans notre phpdoc.xml. On surcharge la classe d'origine pour cela.
$app['config.class'] = 'autodoc\Configuration';
$app['config'] = $app->share(
function ($app) {
$loader = new Loader($app['serializer'], $app['config.merger']);
return $loader->load($app['config.path.template'], $app['config.path.user'], $app['config.class']);
}
);
// Voir : phpDocumentor/Plugin/Core/ServiceProvider
/** @var Translator $translator */
@ -45,6 +57,12 @@ class ServiceProvider implements \Cilex\ServiceProviderInterface
$writerCollection['FileConcat'] = new Writer\FileConcat();
$writerCollection['FileCleaner'] = new Writer\FileCleaner();
// 1c) Sarcharger l'écriveur Twig pour transmettre la configuration
$writerCollection['twig'] = new Writer\Twig();
$writerCollection['twig']->setTranslator($translator);
$writerCollection['twig']->setConfiguration($app['config']);
$writerCollection['twig']->setPhpDocumentorVersion($app::$VERSION);
// 2 Déclarer/surcharger les routes
$app['transformer.routing.queue']->insert(new Router\ZoraRouter(), 20000);
@ -61,10 +79,7 @@ class ServiceProvider implements \Cilex\ServiceProviderInterface
$app['compiler']->insert(new Statistics(), Statistics::COMPILER_PRIORITY);
// 4 Télécharger le code js qui incluera la barrenav si l'option (url) est donnée
if (isset($app['config']['options']['topnav']['value']) and
$app['config']['options']['topnav']['value']
) {
$app['compiler']->insert(new GetTopNav($app), GetTopNav::COMPILER_PRIORITY);
}
$app['compiler']->insert(new GetTopNav($app), GetTopNav::COMPILER_PRIORITY);
}
}

52
src/autodoc/Plugin/Core/Transformer/Writer/Twig.php

@ -0,0 +1,52 @@
<?php
/**
* autodoc
*
* Surcharger l'écriveur Twig pour transmettre
* - la configuration de phpdocumentor
* - la version de phpdocumentor
*/
namespace autodoc\Plugin\Core\Transformer\Writer;
use phpDocumentor\Plugin\Twig\Writer\Twig as TwigPhpDoc;
use phpDocumentor\Configuration;
use phpDocumentor\Descriptor\ProjectDescriptor;
use phpDocumentor\Transformer\Transformation;
class Twig extends TwigPhpDoc
{
/** @var Configuration */
private $configuration;
/** @var array */
private $phpdocInfos = array();
public function setPhpDocumentorVersion($version) {
$this->phpdocInfos['version'] = $version;
}
public function getPhpDocumentorInfos() {
return $this->phpdocInfos;
}
public function setConfiguration(Configuration $configuration) {
$this->configuration = $configuration;
}
public function getConfiguration() {
return $this->configuration;
}
protected function initializeEnvironment(ProjectDescriptor $project, Transformation $transformation, $destination) {
$environment = parent::initializeEnvironment($project, $transformation, $destination);
$environment->addGlobal('configuration', $this->getConfiguration());
$environment->addGlobal('phpDocumentor', $this->getPhpDocumentorInfos());
return $environment;
}
}

38
src/autodoc/Plugin/Core/TwigZora.php

@ -11,8 +11,6 @@ use phpDocumentor\Plugin\Twig\ExtensionInterface;
use phpDocumentor\Transformer\Transformation;
use phpDocumentor\Descriptor\ProjectDescriptor;
use phpDocumentor\Descriptor\Collection;
use Zend\Config\Factory;
use Zend\Config\Config;
use Parsedown;
@ -26,22 +24,6 @@ class TwigZora extends \Twig_Extension implements ExtensionInterface
*/
protected $data = null;
/**
* @var Zend\Config\Config
*/
protected $configuration = null;
/**
* Initializes the runtime environment.
*
* @param Twig_Environment $twigEnvironment The current Twig_Environment instance
*/
public function initRuntime(\Twig_Environment $twigEnvironment) {
// raffraîchir le cache twig si le code source d'un template a changé.
$twigEnvironment->enableAutoReload();
}
/**
* Registers the structure and transformation with this extension.
*
@ -52,15 +34,6 @@ class TwigZora extends \Twig_Extension implements ExtensionInterface
public function __construct(ProjectDescriptor $project, Transformation $transformation)
{
$this->data = $project;
// obtenir les informations de configuration (en trichant) afin d'envoyer des options au template zora
// Note (5 aout 2013) :
// <marcimat> Is there a way to access to the configuration of phpDocumentor (ie. like phpdoc.xml informations)
// in a TWIG plugin ? We recieve a ProjectDescriptor and a Transformation but neither seems to have that.
// <mvriel> marcimat: not yet, a minor refactoring of the configuration
// is something that I desire and then to expose it in Twig
$this->configuration = $this->getPhpDocumentorConfiguration();
}
/**
@ -109,17 +82,6 @@ class TwigZora extends \Twig_Extension implements ExtensionInterface
}
/**
* Returns an array of global variables to inject into a Twig template.
*
* @return mixed
*/
public function getGlobals()
{
return array(
'configuration' => $this->configuration,
);
}
/**
* Liste des fonctions ajoutés à Twig

3
templates/zora/footer/dist.twig

@ -1,5 +1,6 @@
{% block footer %}
Documentation automatique créée avec
<a href="http://www.phpdoc.org/">PHPDocumentor</a> {{ configuration.phpDocumentor.version }}
<a href="http://www.phpdoc.org/">PHPDocumentor</a> {{ phpDocumentor.version }}
- générée le {{ "now"|date("j/m/Y à H:i") }}
{% endblock %}

2
templates/zora/template.xml

@ -67,7 +67,7 @@
<transformation writer="twig" source="templates/zora/htaccess.twig" artifact=".htaccess"/>
<!-- feuille temporaire d'aide au debug -->
<!-- transformation writer="twig" source="templates/zora/debug.twig" artifact="debug.html"/ -->
<transformation writer="twig" source="templates/zora/debug.twig" artifact="debug.html"/>
<!-- nettoyage des vieux fichiers périmés -->
<transformation writer="FileCleaner" source="" artifact="" />

Loading…
Cancel
Save