Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

      (Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

MarkdownDescriptor.php

Zuletzt modifiziert: 09.10.2024, 12:56 - Dateigröße: 4.93 KiB


 001  <?php
 002   
 003  /*
 004   * This file is part of the Symfony package.
 005   *
 006   * (c) Fabien Potencier <fabien@symfony.com>
 007   *
 008   * For the full copyright and license information, please view the LICENSE
 009   * file that was distributed with this source code.
 010   */
 011   
 012  namespace Symfony\Component\Console\Descriptor;
 013   
 014  use Symfony\Component\Console\Application;
 015  use Symfony\Component\Console\Command\Command;
 016  use Symfony\Component\Console\Input\InputArgument;
 017  use Symfony\Component\Console\Input\InputDefinition;
 018  use Symfony\Component\Console\Input\InputOption;
 019   
 020  /**
 021   * Markdown descriptor.
 022   *
 023   * @author Jean-François Simon <contact@jfsimon.fr>
 024   *
 025   * @internal
 026   */
 027  class MarkdownDescriptor extends Descriptor
 028  {
 029      /**
 030       * {@inheritdoc}
 031       */
 032      protected function describeInputArgument(InputArgument $argument, array $options = array())
 033      {
 034          $this->write(
 035              '**'.$argument->getName().':**'."\n\n"
 036              .'* Name: '.($argument->getName() ?: '<none>')."\n"
 037              .'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n"
 038              .'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n"
 039              .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n  ", $argument->getDescription() ?: '<none>')."\n"
 040              .'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`'
 041          );
 042      }
 043   
 044      /**
 045       * {@inheritdoc}
 046       */
 047      protected function describeInputOption(InputOption $option, array $options = array())
 048      {
 049          $this->write(
 050              '**'.$option->getName().':**'."\n\n"
 051              .'* Name: `--'.$option->getName().'`'."\n"
 052              .'* Shortcut: '.($option->getShortcut() ? '`-'.implode('|-', explode('|', $option->getShortcut())).'`' : '<none>')."\n"
 053              .'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n"
 054              .'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n"
 055              .'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n"
 056              .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n  ", $option->getDescription() ?: '<none>')."\n"
 057              .'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`'
 058          );
 059      }
 060   
 061      /**
 062       * {@inheritdoc}
 063       */
 064      protected function describeInputDefinition(InputDefinition $definition, array $options = array())
 065      {
 066          if ($showArguments = count($definition->getArguments()) > 0) {
 067              $this->write('### Arguments:');
 068              foreach ($definition->getArguments() as $argument) {
 069                  $this->write("\n\n");
 070                  $this->write($this->describeInputArgument($argument));
 071              }
 072          }
 073   
 074          if (count($definition->getOptions()) > 0) {
 075              if ($showArguments) {
 076                  $this->write("\n\n");
 077              }
 078   
 079              $this->write('### Options:');
 080              foreach ($definition->getOptions() as $option) {
 081                  $this->write("\n\n");
 082                  $this->write($this->describeInputOption($option));
 083              }
 084          }
 085      }
 086   
 087      /**
 088       * {@inheritdoc}
 089       */
 090      protected function describeCommand(Command $command, array $options = array())
 091      {
 092          $command->getSynopsis();
 093          $command->mergeApplicationDefinition(false);
 094   
 095          $this->write(
 096              $command->getName()."\n"
 097              .str_repeat('-', strlen($command->getName()))."\n\n"
 098              .'* Description: '.($command->getDescription() ?: '<none>')."\n"
 099              .'* Usage:'."\n\n"
 100              .array_reduce(array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
 101                  return $carry.'  * `'.$usage.'`'."\n";
 102              })
 103          );
 104   
 105          if ($help = $command->getProcessedHelp()) {
 106              $this->write("\n");
 107              $this->write($help);
 108          }
 109   
 110          if ($command->getNativeDefinition()) {
 111              $this->write("\n\n");
 112              $this->describeInputDefinition($command->getNativeDefinition());
 113          }
 114      }
 115   
 116      /**
 117       * {@inheritdoc}
 118       */
 119      protected function describeApplication(Application $application, array $options = array())
 120      {
 121          $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
 122          $description = new ApplicationDescription($application, $describedNamespace);
 123   
 124          $this->write($application->getName()."\n".str_repeat('=', strlen($application->getName())));
 125   
 126          foreach ($description->getNamespaces() as $namespace) {
 127              if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
 128                  $this->write("\n\n");
 129                  $this->write('**'.$namespace['id'].':**');
 130              }
 131   
 132              $this->write("\n\n");
 133              $this->write(implode("\n", array_map(function ($commandName) {
 134                  return '* '.$commandName;
 135              }, $namespace['commands'])));
 136          }
 137   
 138          foreach ($description->getCommands() as $command) {
 139              $this->write("\n\n");
 140              $this->write($this->describeCommand($command));
 141          }
 142      }
 143  }
 144