1: <?php
2:
3: declare(strict_types=1);
4:
5: namespace LaravelUi5\OData\Http;
6:
7: /**
8: * Minimal request value object for the QueryPlanner.
9: *
10: * Holds only the URL path and the system query options that the planner needs.
11: * Intentionally independent of Illuminate\Http\Request so that tier-2 tests
12: * (QueryPlanner tests) can construct it without booting Laravel.
13: *
14: * The existing Controller\ODataRequest (legacy) is converted into this type
15: * by the HTTP entry point once it is wired in Step 7.
16: */
17: final readonly class ODataRequest
18: {
19: public function __construct(
20: public readonly string $path,
21: public readonly ?string $filter = null,
22: public readonly ?string $select = null,
23: public readonly ?string $orderBy = null,
24: public readonly ?int $top = null,
25: public readonly ?int $skip = null,
26: public readonly ?string $skipToken = null,
27: public readonly ?string $expand = null,
28: public readonly ?string $search = null,
29: public readonly ?string $compute = null,
30: public readonly bool $count = false,
31: public readonly ?int $maxPageSize = null,
32: ) {}
33:
34: /**
35: * Returns the URL path split into non-empty segments, with percent-decoded characters.
36: *
37: * @return list<string>
38: */
39: public function pathSegments(): array
40: {
41: return array_values(
42: array_filter(
43: array_map('rawurldecode', explode('/', ltrim($this->path, '/'))),
44: 'strlen'
45: )
46: );
47: }
48: }
49: