| 1: | <?php |
| 2: | |
| 3: | declare(strict_types=1); |
| 4: | |
| 5: | |
| 6: | |
| 7: | |
| 8: | |
| 9: | |
| 10: | |
| 11: | |
| 12: | |
| 13: | |
| 14: | namespace Nexus\Mcp\Schema; |
| 15: | |
| 16: | |
| 17: | |
| 18: | |
| 19: | |
| 20: | |
| 21: | |
| 22: | |
| 23: | |
| 24: | |
| 25: | |
| 26: | |
| 27: | final readonly class Implementation extends BaseMetadata |
| 28: | { |
| 29: | |
| 30: | |
| 31: | |
| 32: | |
| 33: | |
| 34: | public function __construct( |
| 35: | string $name, |
| 36: | public string $version, |
| 37: | ?string $title = null, |
| 38: | public ?array $icons = null, |
| 39: | public ?string $websiteUrl = null, |
| 40: | ) { |
| 41: | parent::__construct($name, $title); |
| 42: | } |
| 43: | |
| 44: | #[\Override] |
| 45: | public function toArray(): array |
| 46: | { |
| 47: | return array_filter([ |
| 48: | 'name' => $this->name, |
| 49: | 'version' => $this->version, |
| 50: | 'title' => $this->title, |
| 51: | 'icons' => null === $this->icons ? null : array_map( |
| 52: | static fn(Icon $icon): array => $icon->toArray(), |
| 53: | $this->icons, |
| 54: | ), |
| 55: | 'websiteUrl' => $this->websiteUrl, |
| 56: | ], static fn(mixed $value): bool => null !== $value); |
| 57: | } |
| 58: | } |
| 59: | |