welcome back to dyb-tech
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the NelmioApiDocBundle package.
|
||||
*
|
||||
* (c) Nelmio
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Nelmio\ApiDocBundle\Annotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
*/
|
||||
#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD)]
|
||||
final class Areas
|
||||
{
|
||||
/** @var string[] */
|
||||
private $areas;
|
||||
|
||||
public function __construct(array $properties)
|
||||
{
|
||||
if (!array_key_exists('value', $properties) || !is_array($properties['value'])) {
|
||||
$properties['value'] = array_values($properties);
|
||||
}
|
||||
|
||||
if ([] === $properties['value']) {
|
||||
throw new \InvalidArgumentException('An array of areas was expected');
|
||||
}
|
||||
|
||||
$areas = [];
|
||||
foreach ($properties['value'] as $area) {
|
||||
if (!is_string($area)) {
|
||||
throw new \InvalidArgumentException('An area must be given as a string');
|
||||
}
|
||||
|
||||
if (!in_array($area, $areas)) {
|
||||
$areas[] = $area;
|
||||
}
|
||||
}
|
||||
|
||||
if (0 === count($areas)) {
|
||||
throw new \LogicException('At least one area is expected');
|
||||
}
|
||||
|
||||
$this->areas = $areas;
|
||||
}
|
||||
|
||||
public function has(string $area): bool
|
||||
{
|
||||
return in_array($area, $this->areas, true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the NelmioApiDocBundle package.
|
||||
*
|
||||
* (c) Nelmio
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Nelmio\ApiDocBundle\Annotation;
|
||||
|
||||
use OpenApi\Annotations\Parameter;
|
||||
use OpenApi\Attributes\Attachable;
|
||||
use OpenApi\Generator;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
*/
|
||||
#[\Attribute(\Attribute::TARGET_METHOD)]
|
||||
final class Model extends Attachable
|
||||
{
|
||||
/** {@inheritdoc} */
|
||||
public static $_types = [
|
||||
'type' => 'string',
|
||||
'groups' => '[string]',
|
||||
'options' => '[mixed]',
|
||||
];
|
||||
|
||||
public static $_required = ['type'];
|
||||
|
||||
public static $_parents = [
|
||||
Parameter::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $type;
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
public $groups;
|
||||
|
||||
/**
|
||||
* @var mixed[]
|
||||
*/
|
||||
public $options;
|
||||
|
||||
/**
|
||||
* @var array<string, mixed>
|
||||
*/
|
||||
public $serializationContext;
|
||||
|
||||
/**
|
||||
* @param mixed[] $properties
|
||||
* @param string[] $groups
|
||||
* @param mixed[] $options
|
||||
* @param array<string, mixed> $serializationContext
|
||||
*/
|
||||
public function __construct(
|
||||
array $properties = [],
|
||||
string $type = Generator::UNDEFINED,
|
||||
array $groups = null,
|
||||
array $options = null,
|
||||
array $serializationContext = []
|
||||
) {
|
||||
parent::__construct($properties + [
|
||||
'type' => $type,
|
||||
'groups' => $groups,
|
||||
'options' => $options,
|
||||
'serializationContext' => $serializationContext,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the NelmioApiDocBundle package.
|
||||
*
|
||||
* (c) Nelmio
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Nelmio\ApiDocBundle\Annotation;
|
||||
|
||||
use OpenApi\Annotations\Operation as BaseOperation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
*/
|
||||
#[\Attribute(\Attribute::TARGET_METHOD)]
|
||||
class Operation extends BaseOperation
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the NelmioApiDocBundle package.
|
||||
*
|
||||
* (c) Nelmio
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Nelmio\ApiDocBundle\Annotation;
|
||||
|
||||
use OpenApi\Annotations\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
*/
|
||||
#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
|
||||
class Security extends AbstractAnnotation
|
||||
{
|
||||
/** {@inheritdoc} */
|
||||
public static $_types = [
|
||||
'name' => 'string',
|
||||
'scopes' => '[string]',
|
||||
];
|
||||
|
||||
public static $_required = ['name'];
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
public $scopes = [];
|
||||
|
||||
public function __construct(
|
||||
array $properties = [],
|
||||
string $name = null,
|
||||
array $scopes = []
|
||||
) {
|
||||
parent::__construct($properties + [
|
||||
'name' => $name,
|
||||
'scopes' => $scopes,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user