Updating vendors

1.10.x
Julio Montoya 11 years ago
parent a0b7685be9
commit ff1cc0cc42
  1. 2
      vendor/autoload.php
  2. 10
      vendor/composer/autoload_real.php
  3. 6902
      vendor/composer/installed.json
  4. 4
      vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/DefaultEntityListenerResolver.php
  5. 30
      vendor/nelmio/api-doc-bundle/Nelmio/ApiDocBundle/.travis.yml
  6. 27
      vendor/nelmio/api-doc-bundle/Nelmio/ApiDocBundle/Annotation/ApiDoc.php
  7. 12
      vendor/nelmio/api-doc-bundle/Nelmio/ApiDocBundle/DependencyInjection/Configuration.php
  8. 1
      vendor/nelmio/api-doc-bundle/Nelmio/ApiDocBundle/DependencyInjection/NelmioApiDocExtension.php
  9. 33
      vendor/nelmio/api-doc-bundle/Nelmio/ApiDocBundle/Extractor/Handler/FosRestHandler.php
  10. 2
      vendor/nelmio/api-doc-bundle/Nelmio/ApiDocBundle/Formatter/FormatterInterface.php
  11. 14
      vendor/nelmio/api-doc-bundle/Nelmio/ApiDocBundle/Formatter/HtmlFormatter.php
  12. 2
      vendor/nelmio/api-doc-bundle/Nelmio/ApiDocBundle/Parser/ValidationParser.php
  13. 3
      vendor/nelmio/api-doc-bundle/Nelmio/ApiDocBundle/Resources/config/formatters.xml
  14. 13
      vendor/nelmio/api-doc-bundle/Nelmio/ApiDocBundle/Resources/doc/index.md
  15. 12
      vendor/nelmio/api-doc-bundle/Nelmio/ApiDocBundle/Resources/public/css/screen.css
  16. 51
      vendor/nelmio/api-doc-bundle/Nelmio/ApiDocBundle/Resources/views/layout.html.twig
  17. 11
      vendor/nelmio/api-doc-bundle/Nelmio/ApiDocBundle/Resources/views/method.html.twig
  18. 31
      vendor/nelmio/api-doc-bundle/Nelmio/ApiDocBundle/Tests/Annotation/ApiDocTest.php
  19. 18
      vendor/nelmio/api-doc-bundle/Nelmio/ApiDocBundle/Tests/Extractor/Handler/FosRestHandlerTest.php
  20. 9
      vendor/nelmio/api-doc-bundle/Nelmio/ApiDocBundle/Tests/Fixtures/Controller/TestController.php
  21. 6
      vendor/nelmio/api-doc-bundle/Nelmio/ApiDocBundle/Tests/Fixtures/app/config/routing.yml
  22. 2
      vendor/nelmio/api-doc-bundle/Nelmio/ApiDocBundle/Tests/Parser/ValidationParserTest.php
  23. 1
      vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/bin/sync_assets.sh

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInita4aa94c829bfe1922707cba4e98c7e3f::getLoader();
return ComposerAutoloaderInit1e7699e8f72a6ab1b7bed5f2d20252de::getLoader();

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInita4aa94c829bfe1922707cba4e98c7e3f
class ComposerAutoloaderInit1e7699e8f72a6ab1b7bed5f2d20252de
{
private static $loader;
@ -19,9 +19,9 @@ class ComposerAutoloaderInita4aa94c829bfe1922707cba4e98c7e3f
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInita4aa94c829bfe1922707cba4e98c7e3f', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit1e7699e8f72a6ab1b7bed5f2d20252de', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInita4aa94c829bfe1922707cba4e98c7e3f', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit1e7699e8f72a6ab1b7bed5f2d20252de', 'loadClassLoader'));
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
@ -45,14 +45,14 @@ class ComposerAutoloaderInita4aa94c829bfe1922707cba4e98c7e3f
$includeFiles = require __DIR__ . '/autoload_files.php';
foreach ($includeFiles as $file) {
composerRequirea4aa94c829bfe1922707cba4e98c7e3f($file);
composerRequire1e7699e8f72a6ab1b7bed5f2d20252de($file);
}
return $loader;
}
}
function composerRequirea4aa94c829bfe1922707cba4e98c7e3f($file)
function composerRequire1e7699e8f72a6ab1b7bed5f2d20252de($file)
{
require $file;
}

File diff suppressed because it is too large Load Diff

@ -57,6 +57,7 @@ class DefaultEntityListenerResolver implements EntityListenerResolver
if ( ! is_object($object)) {
throw new \InvalidArgumentException(sprintf('An object was expected, but got "%s".', gettype($object)));
}
$this->instances[get_class($object)] = $object;
}
@ -65,11 +66,10 @@ class DefaultEntityListenerResolver implements EntityListenerResolver
*/
public function resolve($className)
{
if (isset($this->instances[$className = trim($className, '\\')])) {
return $this->instances[$className];
}
return $this->instances[$className] = new $className();
}
}
}

@ -7,28 +7,24 @@ php:
- 5.6
- hhvm
env:
- SYMFONY_VERSION=2.1.*
- SYMFONY_VERSION=2.2.*
- SYMFONY_VERSION=2.3.*
- SYMFONY_VERSION=2.4.*
- SYMFONY_VERSION=dev-master
matrix:
include:
- php: 5.5
env: SYMFONY_VERSION='2.1.*'
- php: 5.5
env: SYMFONY_VERSION='2.2.*'
- php: 5.5
env: SYMFONY_VERSION='2.3.*'
- php: 5.5
env: SYMFONY_VERSION='2.4.*'
- php: 5.5
env: SYMFONY_VERSION='dev-master'
allow_failures:
- env: SYMFONY_VERSION=dev-master
before_script:
- composer self-update
- composer require symfony/twig-bundle:${SYMFONY_VERSION} --no-update
- composer require symfony/twig-bridge:${SYMFONY_VERSION} --no-update
- composer require symfony/framework-bundle:${SYMFONY_VERSION} --no-update
- composer require symfony/validator:${SYMFONY_VERSION} --dev --no-update
- composer require symfony/console:${SYMFONY_VERSION} --no-update
- composer require symfony/css-selector:${SYMFONY_VERSION} --dev --no-update
- composer require symfony/browser-kit:${SYMFONY_VERSION} --dev --no-update
- composer require symfony/yaml:${SYMFONY_VERSION} --dev --no-update
- composer require symfony/form:${SYMFONY_VERSION} --dev --no-update
- composer update
- sh -c 'if [ "$SYMFONY_VERSION" != "" ]; then composer require --no-update symfony/symfony=$SYMFONY_VERSION; fi;'
- composer install
script: phpunit --coverage-text

@ -135,6 +135,11 @@ class ApiDoc
*/
private $statusCodes = array();
/**
* @var array
*/
private $tags = array();
public function __construct(array $data)
{
$this->resource = !empty($data['resource']) ? $data['resource'] : false;
@ -223,6 +228,16 @@ class ApiDoc
$this->deprecated = $data['deprecated'];
}
if (isset($data['tags'])) {
$tags = $data['tags'];
if (!is_array($tags)) {
$tags = array($tags);
}
$this->tags = $tags;
}
if (isset($data['https'])) {
$this->https = $data['https'];
}
@ -507,6 +522,14 @@ class ApiDoc
return $this->requirements;
}
/**
* @return array
*/
public function getTags()
{
return $this->tags;
}
/**
* @param boolean $deprecated
*/
@ -571,6 +594,10 @@ class ApiDoc
$data['cache'] = $cache;
}
if ($tags = $this->tags) {
$data['tags'] = $tags;
}
$data['https'] = $this->https;
$data['authentication'] = $this->authentication;
$data['authenticationRoles'] = $this->authenticationRoles;

@ -57,14 +57,18 @@ class Configuration implements ConfigurationInterface
->arrayNode('request_format')
->addDefaultsIfNotSet()
->children()
->arrayNode('formats')
->defaultValue(array(
'json' => 'application/json',
'xml' => 'application/xml'
))
->prototype('scalar')->end()
->end()
->enumNode('method')
->values(array('format_param', 'accept_header'))
->defaultValue('format_param')
->end()
->enumNode('default_format')
->values(array('json', 'xml'))
->defaultValue('json')
->end()
->scalarNode('default_format')->defaultValue('json')->end()
->end()
->end()
->arrayNode('authentication')

@ -37,6 +37,7 @@ class NelmioApiDocExtension extends Extension
$container->setParameter('nelmio_api_doc.sandbox.accept_type', $config['sandbox']['accept_type']);
$container->setParameter('nelmio_api_doc.sandbox.body_format', $config['sandbox']['body_format']);
$container->setParameter('nelmio_api_doc.sandbox.request_format.default_format', $config['sandbox']['request_format']['default_format']);
$container->setParameter('nelmio_api_doc.sandbox.request_format.formats', $config['sandbox']['request_format']['formats']);
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('formatters.xml');

@ -14,41 +14,66 @@ namespace Nelmio\ApiDocBundle\Extractor\Handler;
use Nelmio\ApiDocBundle\Extractor\HandlerInterface;
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
use Symfony\Component\Routing\Route;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Constraints\Regex;
use FOS\RestBundle\Controller\Annotations\RequestParam;
use FOS\RestBundle\Controller\Annotations\QueryParam;
class FosRestHandler implements HandlerInterface
{
/**
* @inheritdoc
*/
public function handle(ApiDoc $annotation, array $annotations, Route $route, \ReflectionMethod $method)
{
foreach ($annotations as $annot) {
if ($annot instanceof RequestParam) {
$annotation->addParameter($annot->name, array(
'required' => $annot->strict && $annot->default === null,
'dataType' => $annot->requirements,
'dataType' => $this->handleRequirements($annot->requirements),
'description' => $annot->description,
'readonly' => false
));
} elseif ($annot instanceof QueryParam) {
if ($annot->strict && $annot->nullable === false && $annot->default === null) {
$annotation->addRequirement($annot->name, array(
'requirement' => $annot->requirements,
'requirement' => $this->handleRequirements($annot->requirements),
'dataType' => '',
'description' => $annot->description,
));
} elseif ($annot->default !== null) {
$annotation->addFilter($annot->name, array(
'requirement' => $annot->requirements,
'requirement' => $this->handleRequirements($annot->requirements),
'description' => $annot->description,
'default' => $annot->default,
));
} else {
$annotation->addFilter($annot->name, array(
'requirement' => $annot->requirements,
'requirement' => $this->handleRequirements($annot->requirements),
'description' => $annot->description,
));
}
}
}
}
/**
* Handle FOSRestBundle requirements in order to return a string.
*
* @param mixed $requirements
* @return string
*/
private function handleRequirements($requirements)
{
if (is_object($requirements) && $requirements instanceof Constraint) {
if ($requirements instanceof Regex) {
return $requirements->getHtmlPattern();
}
$class = get_class($requirements);
return substr($class, strrpos($class, '\\')+1);
}
return (string) $requirements;
}
}

@ -27,7 +27,7 @@ interface FormatterInterface
* Format documentation data for one route.
*
* @param ApiDoc $annotation
* return string|array
* return string|array
*/
public function formatOne(ApiDoc $annotation);
}

@ -40,6 +40,11 @@ class HtmlFormatter extends AbstractFormatter
*/
private $enableSandbox;
/**
* @var array
*/
private $requestFormats;
/**
* @var string
*/
@ -129,6 +134,14 @@ class HtmlFormatter extends AbstractFormatter
$this->requestFormatMethod = $method;
}
/**
* @param array $formats
*/
public function setRequestFormats(array $formats)
{
$this->requestFormats = $formats;
}
/**
* @param string $format
*/
@ -193,6 +206,7 @@ class HtmlFormatter extends AbstractFormatter
'requestFormatMethod' => $this->requestFormatMethod,
'acceptType' => $this->acceptType,
'bodyFormat' => $this->bodyFormat,
'requestFormats' => $this->requestFormats,
'defaultRequestFormat' => $this->defaultRequestFormat,
'date' => date(DATE_RFC822),
'css' => file_get_contents(__DIR__ . '/../Resources/public/css/screen.css'),

@ -233,7 +233,7 @@ class ValidationParser implements ParserInterface, PostParserInterface
/**
* Return Choice constraint choices.
*
* @param Constraint $constraint
* @param Constraint $constraint
* @param $className
* @return array
* @throws \Symfony\Component\Validator\Exception\ConstraintDefinitionException

@ -37,6 +37,9 @@
<call method="setRequestFormatMethod">
<argument>%nelmio_api_doc.sandbox.request_format.method%</argument>
</call>
<call method="setRequestFormats">
<argument>%nelmio_api_doc.sandbox.request_format.formats%</argument>
</call>
<call method="setDefaultRequestFormat">
<argument>%nelmio_api_doc.sandbox.request_format.default_format%</argument>
</call>

@ -127,6 +127,8 @@ The following properties are available:
* `deprecated`: allow to set method as deprecated (default: `false`);
* `tags`: allow to tag a method (e.g. `beta` or `in-development`). Either a single tag or an array of tags.
* `filters`: an array of filters;
* `requirements`: an array of requirements;
@ -326,11 +328,15 @@ configure this sandbox using the following parameters:
# sandbox requests
request_format:
formats: # default `json` and `xml`,
json: application/json # override to add custom formats or disable
xml: application/xml # default formats
method: format_param # default `format_param`, alternately `accept_header`,
# decides how to request the response format
default_format: json # default `json`, alternately `xml`, determines which
# content format to request back by default
default_format: json # default `json`,
# default content format to request (see formats)
### Command
@ -416,6 +422,9 @@ nelmio_api_doc:
accept_type: ~
body_format: form
request_format:
formats:
json: application/json
xml: application/xml
method: format_param
default_format: json
authentication:

@ -296,6 +296,18 @@ li.operation a.heading h3 span.path {
padding-left: 5px;
}
li.operation a.heading h3 span.tag {
color: #FFFFFF;
font-size: 0.7em;
vertical-align: baseline;
background-color: #d9534f;
padding-bottom: 3px;
padding-left: 6px;
padding-right: 6px;
padding-top: 2px;
border-radius: 4px;
}
li.operation div.content {
border: 1px solid #ddd;
padding: 10px;

@ -24,8 +24,9 @@
</select>
request format:
<select id="request_format">
<option value="json"{{ defaultRequestFormat == 'json' ? ' selected' : '' }}>JSON</option>
<option value="xml"{{ defaultRequestFormat == 'xml' ? ' selected' : '' }}>XML</option>
{% for format, header in requestFormats %}
<option value="{{ header }}"{{ defaultRequestFormat == format ? ' selected' : '' }}>{{ format }}</option>
{% endfor %}
</select>
{% if authentication and authentication.delivery in ['query', 'http_basic', 'header'] %}
api key: <input type="text" id="api_key" value=""/>
@ -51,8 +52,32 @@
</p>
<script type="text/javascript">
var getHash = function() {
return window.location.hash || '';
};
var setHash = function(hash) {
window.location.hash = hash;
};
var clearHash = function() {
var scrollTop, scrollLeft;
if(typeof history === 'object' && typeof history.pushState === 'function') {
history.replaceState('', document.title, window.location.pathname + window.location.search);
} else {
scrollTop = document.body.scrollTop;
scrollLeft = document.body.scrollLeft;
setHash('');
document.body.scrollTop = scrollTop;
document.body.scrollLeft = scrollLeft;
}
};
$(window).load(function() {
var id = (window.location.hash || '').substr(1).replace( /([:\.\[\]\{\}])/g, "\\$1");
var id = getHash().substr(1).replace( /([:\.\[\]\{\}])/g, "\\$1");
var elem = $('#' + id);
if (elem.length) {
setTimeout(function() {
@ -62,8 +87,17 @@
}
});
$('.toggler').click(function() {
$(this).next().slideToggle('fast');
$('.toggler').click(function(event) {
var contentContainer = $(this).next();
if(contentContainer.is(':visible')) {
clearHash();
} else {
setHash($(this).attr('href'));
}
contentContainer.slideToggle('fast');
return false;
});
{% if enableSandbox %}
@ -197,13 +231,12 @@
method = method.split('|').sort().pop();
}
// set default requestFormat
var requestFormat = $('#request_format').val();
// set requestFormat
var requestFormatMethod = '{{ requestFormatMethod }}';
if (requestFormatMethod == 'format_param') {
params['_format'] = requestFormat;
params['_format'] = $('#request_format option:selected').text();
} else if (requestFormatMethod == 'accept_header') {
headers['Accept'] = 'application/' + requestFormat;
headers['Accept'] = $('#request_format').val();
}
// set default bodyFormat

@ -25,6 +25,11 @@
{% endif -%}
{{ data.uri }}
</span>
{% if data.tags is defined %}
{% for tag in data.tags %}
<span class="tag">{{ tag }}</span>
{% endfor %}
{% endif %}
</h3>
<ul class="options">
{% if data.description is defined %}
@ -230,7 +235,7 @@
</p>
{% endif %}
{% endfor %}
<button class="add">New parameter</button>
<button type="button" class="add">New parameter</button>
{% endif %}
</fieldset>
@ -252,7 +257,7 @@
<input type="text" class="value" placeholder="Value" /> <span class="remove">-</span>
</p>
<button class="add">New header</button>
<button type="button" class="add">New header</button>
</fieldset>
<fieldset class="request-content">
@ -264,7 +269,7 @@
<input type="text" class="key content-type" value="Content-Type" disabled="disabled" />
<span>=</span>
<input type="text" class="value" placeholder="Value" />
<button class="set-content-type">Set header</button> <small>Replaces header if set</small>
<button type="button" class="set-content-type">Set header</button> <small>Replaces header if set</small>
</p>
</fieldset>

@ -288,4 +288,35 @@ class ApiDocTest extends TestCase
$this->assertTrue(isset($array['parameters']['fooId']));
$this->assertTrue(isset($array['parameters']['fooId']['dataType']));
}
public function testConstructWithOneTag()
{
$data = array(
'tags' => 'beta'
);
$annot = new ApiDoc($data);
$array = $annot->toArray();
$this->assertTrue(is_array($array));
$this->assertTrue(is_array($array['tags']), 'Single tag should be put in array');
$this->assertEquals(array('beta'), $array['tags']);
}
public function testConstructWithMultipleTags()
{
$data = array(
'tags' => array(
'experimental',
'alpha'
)
);
$annot = new ApiDoc($data);
$array = $annot->toArray();
$this->assertTrue(is_array($array));
$this->assertTrue(is_array($array['tags']), 'Tags should be in array');
$this->assertEquals($data['tags'], $array['tags']);
}
}

@ -87,4 +87,22 @@ class FosRestHandlerTest extends WebTestCase
$this->assertArrayNotHasKey('default', $filter);
}
public function testGetWithConstraintAsRequirements()
{
$container = $this->getContainer();
$extractor = $container->get('nelmio_api_doc.extractor.api_doc_extractor');
$annotation = $extractor->get('Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::zActionWithConstraintAsRequirements', 'test_route_21');
$this->assertNotNull($annotation);
$filters = $annotation->getFilters();
$this->assertCount(1, $filters);
$this->assertArrayHasKey('mail', $filters);
$filter = $filters['mail'];
$this->assertArrayHasKey('requirement', $filter);
$this->assertEquals($filter['requirement'], 'Email');
}
}

@ -15,6 +15,7 @@ use FOS\RestBundle\Controller\Annotations\QueryParam;
use FOS\RestBundle\Controller\Annotations\RequestParam;
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Validator\Constraints\Email;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache;
class TestController
@ -130,6 +131,14 @@ class TestController
{
}
/**
* @ApiDoc()
* @QueryParam(name="mail", requirements=@Email, description="Email of someone.")
*/
public function zActionWithConstraintAsRequirements()
{
}
/**
* @ApiDoc(
* description="Testing JMS",

@ -149,3 +149,9 @@ test_route_private:
test_route_exclusive:
pattern: /exclusive
defaults: { _controller: NelmioApiDocTestBundle:Test:exclusive }
test_route_21:
pattern: /z-action-with-constraint-requirements
defaults: { _controller: NelmioApiDocTestBundle:Test:zActionWithConstraintAsRequirements }
requirements:
_method: GET

@ -13,7 +13,7 @@ class ValidationParserTest extends WebTestCase
public function setUp()
{
$container = $this->getContainer();
$factory = $container->get('validator.mapping.class_metadata_factory');
$factory = $container->get('validator')->getMetadataFactory();
if (version_compare(Kernel::VERSION, '2.2.0', '<')) {
$this->parser = new ValidationParserLegacy($factory);

@ -4,4 +4,3 @@ DIR=`php -r "echo realpath(dirname('$0'));"`
cp $DIR/../../../FrameworkBundle/Resources/public/css/body.css $DIR/../views/Profiler/body.css.twig
cp $DIR/../../../FrameworkBundle/Resources/public/css/exception.css $DIR/../views/Collector/exception.css.twig

Loading…
Cancel
Save