This repository was archived by the owner on Apr 29, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +37
-2
lines changed Expand file tree Collapse file tree 3 files changed +37
-2
lines changed Original file line number Diff line number Diff line change 55namespace Depth \Techno ;
66
77use Depth \Techno \Exceptions \EnvNotFoundException ;
8+ use Depth \Techno \Exceptions \RouteNotFoundException ;
9+ use Depth \Techno \Exceptions \RouterException ;
10+ use Depth \Techno \Exceptions \ServiceNotFoundException ;
811use M1 \Env \Parser ;
12+ use ReflectionException ;
913
1014final readonly class App
1115{
1216 private Container $ container ;
1317
18+ /**
19+ * @throws EnvNotFoundException
20+ */
1421 public function __construct (
1522 string $ env_path = __DIR__ .'/.env ' ,
1623 private string $ router_path = __DIR__ .'/routes.php ' ,
@@ -21,6 +28,12 @@ public function __construct(
2128 $ this ->container = new Container ();
2229 }
2330
31+ /**
32+ * @throws ServiceNotFoundException
33+ * @throws RouterException
34+ * @throws ReflectionException
35+ * @throws RouteNotFoundException
36+ */
2437 public function run (): void
2538 {
2639 if ($ _ENV ['DEBUG ' ] ?? false ) {
@@ -32,6 +45,9 @@ public function run(): void
3245 $ router ->resolve ($ this ->router_path )->send ();
3346 }
3447
48+ /**
49+ * @throws EnvNotFoundException
50+ */
3551 private function loadEnv (string $ env_path ): void
3652 {
3753 $ contents = file_get_contents ($ env_path );
Original file line number Diff line number Diff line change @@ -21,6 +21,9 @@ final class Container implements ContainerInterface
2121
2222 /**
2323 * @param class-string $id
24+ *
25+ * @throws ServiceNotFoundException
26+ * @throws ReflectionException
2427 */
2528 public function get (string $ id ): object
2629 {
@@ -62,6 +65,8 @@ public function set(string $id, object $value): self
6265
6366 /**
6467 * @param class-string $id
68+ *
69+ * @throws ServiceNotFoundException
6570 */
6671 private function resolve (string $ id ): object
6772 {
@@ -83,6 +88,9 @@ private function resolve(string $id): object
8388
8489 /**
8590 * @param ReflectionClass<object> $item
91+ *
92+ * @throws ServiceNotFoundException
93+ * @throws ReflectionException
8694 */
8795 private function getInstance (ReflectionClass $ item ): object
8896 {
Original file line number Diff line number Diff line change 66
77use Depth \Techno \Exceptions \RouteNotFoundException ;
88use Depth \Techno \Exceptions \RouterException ;
9+ use Depth \Techno \Exceptions \ServiceNotFoundException ;
10+ use ReflectionException ;
911use Symfony \Component \HttpFoundation \Response ;
1012
1113use function array_key_exists ;
1820 public function __construct (
1921 private Container $ container ,
2022 ) {
21- $ this ->path = explode ('/ ' , trim (explode ('? ' , $ _SERVER ['REQUEST_URI ' ] ?? '' )[0 ], '/ ' ));
23+ $ this ->path = explode (
24+ '/ ' ,
25+ trim (explode ('? ' , $ _SERVER ['REQUEST_URI ' ] ?? '' )[0 ], '/ ' ),
26+ );
2227 }
2328
29+ /**
30+ * @throws ServiceNotFoundException
31+ * @throws RouterException
32+ * @throws ReflectionException
33+ * @throws RouteNotFoundException
34+ */
2435 public function resolve (string $ router_path ): Response
2536 {
26- /** @var array<string, class-string> */
37+ /** @var array<string, class-string> $router_path */
2738 $ routes = require $ router_path ;
2839
2940 $ link = "{$ _SERVER ['REQUEST_METHOD ' ]} / {$ this ->path [0 ]}" ;
You can’t perform that action at this time.
0 commit comments