@@ -35,81 +35,81 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | final class SearchResult implements JsonSerializable { |
| 37 | 37 | |
| 38 | - /** @var string */ |
|
| 39 | - private $name; |
|
| 38 | + /** @var string */ |
|
| 39 | + private $name; |
|
| 40 | 40 | |
| 41 | - /** @var bool */ |
|
| 42 | - private $isPaginated; |
|
| 41 | + /** @var bool */ |
|
| 42 | + private $isPaginated; |
|
| 43 | 43 | |
| 44 | - /** @var SearchResultEntry[] */ |
|
| 45 | - private $entries; |
|
| 44 | + /** @var SearchResultEntry[] */ |
|
| 45 | + private $entries; |
|
| 46 | 46 | |
| 47 | - /** @var int|string|null */ |
|
| 48 | - private $cursor; |
|
| 47 | + /** @var int|string|null */ |
|
| 48 | + private $cursor; |
|
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * @param string $name the translated name of the result section or group, e.g. "Mail" |
|
| 52 | - * @param bool $isPaginated |
|
| 53 | - * @param SearchResultEntry[] $entries |
|
| 54 | - * @param null $cursor |
|
| 55 | - * |
|
| 56 | - * @since 20.0.0 |
|
| 57 | - */ |
|
| 58 | - private function __construct(string $name, |
|
| 59 | - bool $isPaginated, |
|
| 60 | - array $entries, |
|
| 61 | - $cursor = null) { |
|
| 62 | - $this->name = $name; |
|
| 63 | - $this->isPaginated = $isPaginated; |
|
| 64 | - $this->entries = $entries; |
|
| 65 | - $this->cursor = $cursor; |
|
| 66 | - } |
|
| 50 | + /** |
|
| 51 | + * @param string $name the translated name of the result section or group, e.g. "Mail" |
|
| 52 | + * @param bool $isPaginated |
|
| 53 | + * @param SearchResultEntry[] $entries |
|
| 54 | + * @param null $cursor |
|
| 55 | + * |
|
| 56 | + * @since 20.0.0 |
|
| 57 | + */ |
|
| 58 | + private function __construct(string $name, |
|
| 59 | + bool $isPaginated, |
|
| 60 | + array $entries, |
|
| 61 | + $cursor = null) { |
|
| 62 | + $this->name = $name; |
|
| 63 | + $this->isPaginated = $isPaginated; |
|
| 64 | + $this->entries = $entries; |
|
| 65 | + $this->cursor = $cursor; |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * @param SearchResultEntry[] $entries |
|
| 70 | - * |
|
| 71 | - * @return static |
|
| 72 | - * |
|
| 73 | - * @since 20.0.0 |
|
| 74 | - */ |
|
| 75 | - public static function complete(string $name, array $entries): self { |
|
| 76 | - return new self( |
|
| 77 | - $name, |
|
| 78 | - false, |
|
| 79 | - $entries |
|
| 80 | - ); |
|
| 81 | - } |
|
| 68 | + /** |
|
| 69 | + * @param SearchResultEntry[] $entries |
|
| 70 | + * |
|
| 71 | + * @return static |
|
| 72 | + * |
|
| 73 | + * @since 20.0.0 |
|
| 74 | + */ |
|
| 75 | + public static function complete(string $name, array $entries): self { |
|
| 76 | + return new self( |
|
| 77 | + $name, |
|
| 78 | + false, |
|
| 79 | + $entries |
|
| 80 | + ); |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * @param SearchResultEntry[] $entries |
|
| 85 | - * @param int|string $cursor |
|
| 86 | - * |
|
| 87 | - * @return static |
|
| 88 | - * |
|
| 89 | - * @since 20.0.0 |
|
| 90 | - */ |
|
| 91 | - public static function paginated(string $name, |
|
| 92 | - array $entries, |
|
| 93 | - $cursor): self { |
|
| 94 | - return new self( |
|
| 95 | - $name, |
|
| 96 | - true, |
|
| 97 | - $entries, |
|
| 98 | - $cursor |
|
| 99 | - ); |
|
| 100 | - } |
|
| 83 | + /** |
|
| 84 | + * @param SearchResultEntry[] $entries |
|
| 85 | + * @param int|string $cursor |
|
| 86 | + * |
|
| 87 | + * @return static |
|
| 88 | + * |
|
| 89 | + * @since 20.0.0 |
|
| 90 | + */ |
|
| 91 | + public static function paginated(string $name, |
|
| 92 | + array $entries, |
|
| 93 | + $cursor): self { |
|
| 94 | + return new self( |
|
| 95 | + $name, |
|
| 96 | + true, |
|
| 97 | + $entries, |
|
| 98 | + $cursor |
|
| 99 | + ); |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | - /** |
|
| 103 | - * @return array |
|
| 104 | - * |
|
| 105 | - * @since 20.0.0 |
|
| 106 | - */ |
|
| 107 | - public function jsonSerialize(): array { |
|
| 108 | - return [ |
|
| 109 | - 'name' => $this->name, |
|
| 110 | - 'isPaginated' => $this->isPaginated, |
|
| 111 | - 'entries' => array_values($this->entries), |
|
| 112 | - 'cursor' => $this->cursor, |
|
| 113 | - ]; |
|
| 114 | - } |
|
| 102 | + /** |
|
| 103 | + * @return array |
|
| 104 | + * |
|
| 105 | + * @since 20.0.0 |
|
| 106 | + */ |
|
| 107 | + public function jsonSerialize(): array { |
|
| 108 | + return [ |
|
| 109 | + 'name' => $this->name, |
|
| 110 | + 'isPaginated' => $this->isPaginated, |
|
| 111 | + 'entries' => array_values($this->entries), |
|
| 112 | + 'cursor' => $this->cursor, |
|
| 113 | + ]; |
|
| 114 | + } |
|
| 115 | 115 | } |