Total Complexity | 5 |
Total Lines | 78 |
Duplicated Lines | 0 % |
Coverage | 80% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | class Inspector |
||
14 | { |
||
15 | /** |
||
16 | * The inspector instances. |
||
17 | * |
||
18 | * @var array |
||
19 | */ |
||
20 | protected static $instances = []; |
||
21 | |||
22 | /** |
||
23 | * The `use` statements cache. |
||
24 | * |
||
25 | * @var array |
||
26 | */ |
||
27 | protected $useStatements; |
||
28 | |||
29 | /** |
||
30 | * The properties cache. |
||
31 | * |
||
32 | * @var array |
||
33 | */ |
||
34 | protected $properties; |
||
35 | |||
36 | /** |
||
37 | * The relationships cache. |
||
38 | * |
||
39 | * @var array |
||
40 | */ |
||
41 | protected $relationships; |
||
42 | |||
43 | /** |
||
44 | * Instantiate the class. |
||
45 | * |
||
46 | * @param string $model |
||
47 | */ |
||
48 | protected function __construct(protected string $model) |
||
49 | { |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * Statically instantiate the class |
||
54 | * |
||
55 | * @param string $model |
||
56 | * @return static |
||
57 | */ |
||
58 | 6 | public static function inspect(string $model): static |
|
61 | } |
||
62 | |||
63 | /** |
||
64 | * Retrieve the `use` statements |
||
65 | * |
||
66 | * @return array |
||
67 | */ |
||
68 | 2 | public function getUseStatements(): array |
|
69 | { |
||
70 | 2 | return $this->useStatements ??= UseStatements::of($this->model)->get(); |
|
71 | } |
||
72 | |||
73 | /** |
||
74 | * Retrieve the properties |
||
75 | * |
||
76 | * @return array |
||
77 | */ |
||
78 | 1 | public function getProperties(): array |
|
79 | { |
||
80 | 1 | return $this->properties ??= Properties::of($this->model)->get(); |
|
81 | } |
||
82 | |||
83 | /** |
||
84 | * Retrieve the relationships |
||
85 | * |
||
86 | * @return array |
||
87 | */ |
||
88 | 1 | public function getRelationships(): array |
|
91 | } |
||
92 | } |
||
93 |