OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
API
/
vendor
/
zircote
/
swagger-php
/
src
/
Processors
/
Concerns
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
08/07/2024 04:34:51 AM
rwxr-xr-x
📄
CollectorTrait.php
1.71 KB
08/07/2024 04:34:51 AM
rw-r--r--
📄
DocblockTrait.php
6.47 KB
08/07/2024 04:34:51 AM
rw-r--r--
📄
MergePropertiesTrait.php
2.27 KB
08/07/2024 04:34:51 AM
rw-r--r--
📄
RefTrait.php
440 bytes
08/07/2024 04:34:51 AM
rw-r--r--
📄
TypesTrait.php
1.66 KB
08/07/2024 04:34:51 AM
rw-r--r--
Editing: MergePropertiesTrait.php
Close
<?php declare(strict_types=1); /** * @license Apache 2.0 */ namespace OpenApi\Processors\Concerns; use OpenApi\Analysis; use OpenApi\Annotations as OA; use OpenApi\Context; use OpenApi\Generator; /** * Steps: * 1. Determine direct parent / interfaces / traits * 2. With each: * - traverse up inheritance tree * - inherit from first with schema; all other with scheme can be ignored * - merge from all without schema * => update all $ref that might reference a property merged. */ trait MergePropertiesTrait { protected function inheritFrom(Analysis $analysis, OA\Schema $schema, OA\Schema $from, string $refPath, Context $context): void { if (Generator::isDefault($schema->allOf)) { $schema->allOf = []; } // merging other properties into allOf is done in the AugmentSchemas processor $schema->allOf[] = $refSchema = new OA\Schema([ 'ref' => OA\Components::ref($refPath), '_context' => new Context(['generated' => true], $context), ]); $analysis->addAnnotation($refSchema, $refSchema->_context); } protected function mergeProperties(OA\Schema $schema, array $from, array &$existing): void { foreach ($from['properties'] as $context) { if (is_iterable($context->annotations)) { foreach ($context->annotations as $annotation) { if ($annotation instanceof OA\Property && !in_array($annotation->_context->property, $existing, true)) { $existing[] = $annotation->_context->property; $schema->merge([$annotation], true); } } } } } protected function mergeMethods(OA\Schema $schema, array $from, array &$existing): void { foreach ($from['methods'] as $context) { if (is_iterable($context->annotations)) { foreach ($context->annotations as $annotation) { if ($annotation instanceof OA\Property && !in_array($annotation->_context->property, $existing, true)) { $existing[] = $annotation->_context->property; $schema->merge([$annotation], true); } } } } } }