| 1 |
<?php declare(strict_types=1); |
| 2 |
|
| 3 |
/** |
| 4 |
* @license Apache 2.0 |
| 5 |
*/ |
| 6 |
|
| 7 |
namespace OpenApi\Processors\Concerns; |
| 8 |
|
| 9 |
use OpenApi\Analysis; |
| 10 |
use OpenApi\Annotations as OA; |
| 11 |
|
| 12 |
trait AnnotationTrait |
| 13 |
{ |
| 14 |
protected function removeAnnotationRecursive(Analysis $analysis, OA\AbstractAnnotation $annotation): void |
| 15 |
{ |
| 16 |
$analysis->removeAnnotation($annotation); |
| 17 |
|
| 18 |
foreach (get_object_vars($annotation) as $property => $value) { |
| 19 |
if (in_array($property, $annotation::$_blacklist)) { |
| 20 |
continue; |
| 21 |
} |
| 22 |
if (is_array($value)) { |
| 23 |
foreach ($value as $item) { |
| 24 |
if ($item instanceof OA\AbstractAnnotation) { |
| 25 |
$this->removeAnnotationRecursive($analysis, $item); |
| 26 |
} |
| 27 |
} |
| 28 |
} elseif ($value instanceof OA\AbstractAnnotation) { |
| 29 |
$this->removeAnnotationRecursive($analysis, $value); |
| 30 |
} |
| 31 |
} |
| 32 |
} |
| 33 |
} |