| Total Complexity | 5 |
| Total Lines | 49 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | final class DocumentMetadata |
||
| 26 | { |
||
| 27 | public const DEFAULT_TYPE = '_doc'; |
||
| 28 | |||
| 29 | private $index; |
||
| 30 | private $type; |
||
| 31 | |||
| 32 | public function __construct(?string $index = null, string $type = self::DEFAULT_TYPE) |
||
| 33 | { |
||
| 34 | $this->index = $index; |
||
| 35 | $this->type = $type; |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Gets a new instance with the given index. |
||
| 40 | */ |
||
| 41 | public function withIndex(string $index): self |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Gets the document index. |
||
| 51 | */ |
||
| 52 | public function getIndex(): ?string |
||
| 53 | { |
||
| 54 | return $this->index; |
||
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Gets a new instance with the given type. |
||
| 59 | */ |
||
| 60 | public function withType(string $type): self |
||
| 66 | } |
||
| 67 | |||
| 68 | /** |
||
| 69 | * Gets the document type. |
||
| 70 | */ |
||
| 71 | public function getType(): string |
||
| 76 |