1717use Symfony \Component \HttpFoundation \JsonResponse ;
1818use Symfony \Component \HttpFoundation \Request ;
1919use Symfony \Component \HttpFoundation \Response ;
20- use Symfony \Component \HttpKernel \Exception \NotFoundHttpException ;
2120use Symfony \Component \Messenger \Envelope ;
2221use Symfony \Component \Messenger \MessageBusInterface ;
2322use Symfony \Component \Messenger \Stamp \TransportNamesStamp ;
@@ -79,13 +78,13 @@ public function packageMetadata(string $packageName): Response
7978 $ basePackageName = u ($ packageName )->trimSuffix ('~dev ' )->toString ();
8079
8180 if (null === $ package = $ this ->findPackage ($ basePackageName )) {
82- throw new NotFoundHttpException ();
81+ throw $ this -> createNotFoundException ();
8382 }
8483
8584 $ this ->messenger ->dispatch (new UpdatePackage ($ package ->getId ()));
8685
8786 if (!$ this ->providerManager ->exists ($ packageName )) {
88- throw new NotFoundHttpException ();
87+ throw $ this -> createNotFoundException ();
8988 }
9089
9190 return new BinaryFileResponse ($ this ->providerManager ->path ($ packageName ), headers: ['Content-Type ' => 'application/json ' ]);
@@ -105,26 +104,26 @@ public function packageMetadata(string $packageName): Response
105104 public function packageDistribution (string $ packageName , string $ packageVersion , string $ reference , string $ type ): Response
106105 {
107106 if (!$ this ->getParameter ('dirigent.dist_mirroring.enabled ' )) {
108- throw new NotFoundHttpException ();
107+ throw $ this -> createNotFoundException ();
109108 }
110109
111110 if (!$ this ->distributionResolver ->exists ($ packageName , $ packageVersion , $ reference , $ type )) {
112111 if (null === $ package = $ this ->packageRepository ->findOneBy (['name ' => $ packageName ])) {
113- throw new NotFoundHttpException ();
112+ throw $ this -> createNotFoundException ();
114113 }
115114
116115 if (null === $ version = $ this ->versionRepository ->findOneBy (['package ' => $ package , 'normalizedVersion ' => $ packageVersion ])) {
117- throw new NotFoundHttpException ();
116+ throw $ this -> createNotFoundException ();
118117 }
119118
120119 if ($ version ->isDevelopment () && !$ this ->getParameter ('dirigent.dist_mirroring.dev_packages ' )) {
121- throw new NotFoundHttpException ();
120+ throw $ this -> createNotFoundException ();
122121 }
123122
124123 $ this ->messenger ->dispatch (new UpdatePackage ($ package ->getId ()));
125124
126125 if (!$ this ->distributionResolver ->resolve ($ version , $ reference , $ type )) {
127- throw new NotFoundHttpException ();
126+ throw $ this -> createNotFoundException ();
128127 }
129128 }
130129
0 commit comments