Skip to content

Commit 4a166fc

Browse files
chore: simplify model initialization
1 parent 3898066 commit 4a166fc

35 files changed

+63
-60
lines changed

src/Core/Concerns/SdkModel.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ public function __unserialize(array $data): void
5050
}
5151

5252
/**
53+
* @internal
54+
*
5355
* @return array<string, mixed>
5456
*/
5557
public function __debugInfo(): array
@@ -135,8 +137,6 @@ public function offsetExists(mixed $offset): bool
135137
* @internal
136138
*
137139
* @param key-of<Shape> $offset
138-
*
139-
* @return value-of<Shape>
140140
*/
141141
public function &offsetGet(mixed $offset): mixed
142142
{
@@ -205,6 +205,8 @@ public function offsetUnset(mixed $offset): void
205205
}
206206

207207
/**
208+
* @internal
209+
*
208210
* @return array<string, mixed>
209211
*/
210212
public function jsonSerialize(): array
@@ -238,16 +240,10 @@ public static function converter(): Converter
238240
/**
239241
* @internal
240242
*/
241-
public static function introspect(): void
243+
private function initialize(): void
242244
{
243245
static::converter();
244-
}
245246

246-
/**
247-
* @internal
248-
*/
249-
private function unsetOptionalProperties(): void
250-
{
251247
foreach (self::$converter->properties as $name => $info) {
252248
if ($info->optional) {
253249
unset($this->{$name});

src/Core/Concerns/SdkPage.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function getNextPage(): static
7070
}
7171

7272
/**
73-
* Generator yielding each page (instance of static).
73+
* Iterator yielding each page (instance of static).
7474
*
7575
* @return \Generator<static>
7676
*/
@@ -87,7 +87,7 @@ public function getIterator(): \Generator
8787
}
8888

8989
/**
90-
* Generator yielding each item across all pages.
90+
* Iterator yielding each item across all pages.
9191
*
9292
* @return \Generator<Item>
9393
*/
@@ -101,13 +101,17 @@ public function pagingEachItem(): \Generator
101101
}
102102

103103
/**
104+
* @internal
105+
*
104106
* @param array<string, mixed> $data
105107
*
106108
* @return static<Item>
107109
*/
108110
abstract public static function fromArray(array $data): static;
109111

110112
/**
113+
* @internal
114+
*
111115
* @return array{normalized_request, RequestOptions}
112116
*/
113117
abstract protected function nextRequest(): ?array;

src/Core/Services/CrawlService.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
final class CrawlService implements CrawlContract
1818
{
19+
/**
20+
* @internal
21+
*/
1922
public function __construct(private Client $client) {}
2023

2124
/**

src/Core/Services/CreditsService.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
final class CreditsService implements CreditsContract
1313
{
14+
/**
15+
* @internal
16+
*/
1417
public function __construct(private Client $client) {}
1518

1619
/**

src/Core/Services/FeedbackService.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414

1515
final class FeedbackService implements FeedbackContract
1616
{
17+
/**
18+
* @internal
19+
*/
1720
public function __construct(private Client $client) {}
1821

1922
/**

src/Core/Services/GenerateSchemaService.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717

1818
final class GenerateSchemaService implements GenerateSchemaContract
1919
{
20+
/**
21+
* @internal
22+
*/
2023
public function __construct(private Client $client) {}
2124

2225
/**

src/Core/Services/HealthzService.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
final class HealthzService implements HealthzContract
1313
{
14+
/**
15+
* @internal
16+
*/
1417
public function __construct(private Client $client) {}
1518

1619
/**

src/Core/Services/MarkdownifyService.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
final class MarkdownifyService implements MarkdownifyContract
1818
{
19+
/**
20+
* @internal
21+
*/
1922
public function __construct(private Client $client) {}
2023

2124
/**

src/Core/Services/SearchscraperService.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
final class SearchscraperService implements SearchscraperContract
1818
{
19+
/**
20+
* @internal
21+
*/
1922
public function __construct(private Client $client) {}
2023

2124
/**

src/Core/Services/SmartscraperService.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717

1818
final class SmartscraperService implements SmartscraperContract
1919
{
20+
/**
21+
* @internal
22+
*/
2023
public function __construct(private Client $client) {}
2124

2225
/**

0 commit comments

Comments
 (0)