Merge pull request #7 from retailcrm/upgrade

Upgrade
This commit is contained in:
Alexey 2022-07-12 10:14:30 +03:00 committed by GitHub
commit 8d699084aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 32 additions and 16 deletions

View File

@ -1,3 +1,5 @@
dist: trusty
language: php language: php
sudo: false sudo: false

View File

@ -18,9 +18,16 @@ class Configuration implements ConfigurationInterface
{ {
public function getConfigTreeBuilder() public function getConfigTreeBuilder()
{ {
$treeBuilder = new TreeBuilder(); $treeBuilder = new TreeBuilder('nelmio_api_doc');
$treeBuilder
->root('nelmio_api_doc') if (method_exists($treeBuilder, 'getRootNode')) {
$rootNode = $treeBuilder->getRootNode();
} else {
// symfony < 4.2 support
$rootNode = $treeBuilder->root('nelmio_api_doc');
}
$rootNode
->children() ->children()
->scalarNode('name')->defaultValue('API documentation')->end() ->scalarNode('name')->defaultValue('API documentation')->end()
->arrayNode('exclude_sections') ->arrayNode('exclude_sections')
@ -31,7 +38,7 @@ class Configuration implements ConfigurationInterface
->arrayNode('motd') ->arrayNode('motd')
->addDefaultsIfNotSet() ->addDefaultsIfNotSet()
->children() ->children()
->scalarNode('template')->defaultValue('NelmioApiDocBundle::Components/motd.html.twig')->end() ->scalarNode('template')->defaultValue('@NelmioApiDoc/Components/motd.html.twig')->end()
->end() ->end()
->end() ->end()
->arrayNode('request_listener') ->arrayNode('request_listener')

View File

@ -12,6 +12,7 @@
namespace Nelmio\ApiDocBundle\Formatter; namespace Nelmio\ApiDocBundle\Formatter;
use Symfony\Component\Templating\EngineInterface; use Symfony\Component\Templating\EngineInterface;
use Twig\Environment as TwigEnvironment;
class HtmlFormatter extends AbstractFormatter class HtmlFormatter extends AbstractFormatter
{ {
@ -31,7 +32,7 @@ class HtmlFormatter extends AbstractFormatter
protected $defaultRequestFormat; protected $defaultRequestFormat;
/** /**
* @var EngineInterface * @var EngineInterface|TwigEnvironment
*/ */
protected $engine; protected $engine;
@ -113,9 +114,9 @@ class HtmlFormatter extends AbstractFormatter
} }
/** /**
* @param EngineInterface $engine * @param EngineInterface|TwigEnvironment $engine
*/ */
public function setTemplatingEngine(EngineInterface $engine) public function setTemplatingEngine($engine)
{ {
$this->engine = $engine; $this->engine = $engine;
} }
@ -197,7 +198,7 @@ class HtmlFormatter extends AbstractFormatter
*/ */
protected function renderOne(array $data) protected function renderOne(array $data)
{ {
return $this->engine->render('NelmioApiDocBundle::resource.html.twig', array_merge( return $this->engine->render('@NelmioApiDoc/resource.html.twig', array_merge(
array( array(
'data' => $data, 'data' => $data,
'displayContent' => true, 'displayContent' => true,
@ -211,7 +212,7 @@ class HtmlFormatter extends AbstractFormatter
*/ */
protected function render(array $collection) protected function render(array $collection)
{ {
return $this->engine->render('NelmioApiDocBundle::resources.html.twig', array_merge( return $this->engine->render('@NelmioApiDoc/resources.html.twig', array_merge(
array( array(
'resources' => $collection, 'resources' => $collection,
), ),

View File

@ -21,7 +21,7 @@
<service id="nelmio_api_doc.formatter.html_formatter" class="%nelmio_api_doc.formatter.html_formatter.class%" <service id="nelmio_api_doc.formatter.html_formatter" class="%nelmio_api_doc.formatter.html_formatter.class%"
parent="nelmio_api_doc.formatter.abstract_formatter" public="true"> parent="nelmio_api_doc.formatter.abstract_formatter" public="true">
<call method="setTemplatingEngine"> <call method="setTemplatingEngine">
<argument type="service" id="templating" /> <argument type="service" id="twig" />
</call> </call>
<call method="setMotdTemplate"> <call method="setMotdTemplate">
<argument>%nelmio_api_doc.motd.template%</argument> <argument>%nelmio_api_doc.motd.template%</argument>

View File

@ -8,7 +8,7 @@ Configuration Reference
exclude_sections: [] exclude_sections: []
default_sections_opened: true default_sections_opened: true
motd: motd:
template: 'NelmioApiDocBundle::Components/motd.html.twig' template: '@NelmioApiDoc/Components/motd.html.twig'
request_listener: request_listener:
enabled: true enabled: true
parameter: _doc parameter: _doc

View File

@ -189,7 +189,7 @@
<tr> <tr>
<td>{{ name }}</td> <td>{{ name }}</td>
<td>{{ infos.dataType }}</td> <td>{{ infos.dataType }}</td>
<td>{% include 'NelmioApiDocBundle:Components:version.html.twig' with {'sinceVersion': infos.sinceVersion, 'untilVersion': infos.untilVersion} only %}</td> <td>{% include '@NelmioApiDoc/Components/version.html.twig' with {'sinceVersion': infos.sinceVersion, 'untilVersion': infos.untilVersion} only %}</td>
<td>{{ infos.description }}</td> <td>{{ infos.description }}</td>
</tr> </tr>
{% endfor %} {% endfor %}

View File

@ -1,11 +1,11 @@
{% extends "NelmioApiDocBundle::layout.html.twig" %} {% extends "@NelmioApiDoc/layout.html.twig" %}
{% block content %} {% block content %}
<li class="resource"> <li class="resource">
<ul class="endpoints"> <ul class="endpoints">
<li class="endpoint"> <li class="endpoint">
<ul class="operations"> <ul class="operations">
{% include 'NelmioApiDocBundle::method.html.twig' %} {% include '@NelmioApiDoc/method.html.twig' %}
</ul> </ul>
</li> </li>
</ul> </ul>

View File

@ -1,4 +1,4 @@
{% extends "NelmioApiDocBundle::layout.html.twig" %} {% extends "@NelmioApiDoc/layout.html.twig" %}
{% block content %} {% block content %}
<div id="summary"> <div id="summary">
@ -33,7 +33,7 @@
<li class="endpoint"> <li class="endpoint">
<ul class="operations"> <ul class="operations">
{% for data in methods %} {% for data in methods %}
{% include 'NelmioApiDocBundle::method.html.twig' %} {% include '@NelmioApiDoc/method.html.twig' %}
{% endfor %} {% endfor %}
</ul> </ul>
</li> </li>

View File

@ -622,6 +622,9 @@ dependency_type[a]:
_This method is useful to test if the getDocComment works._ _This method is useful to test if the getDocComment works._
This method is useful to test if the getDocComment works.
And, it supports multilines until the first '@' char.
#### Requirements #### #### Requirements ####
**id** **id**

View File

@ -706,6 +706,9 @@ dependency_type[a]:
_This method is useful to test if the getDocComment works._ _This method is useful to test if the getDocComment works._
This method is useful to test if the getDocComment works.
And, it supports multilines until the first '@' char.
#### Requirements #### #### Requirements ####
**id** **id**