Passed
Push — master ( fbbe3c...8b0281 )
by Anthony
03:02
created
Service/PackagistApi.php 2 patches
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -6,67 +6,67 @@
 block discarded – undo
6 6
 
7 7
 class PackagistApi
8 8
 {
9
-    /**
10
-     * @var HttpClientInterface
11
-     */
12
-    private $client;
9
+				/**
10
+				 * @var HttpClientInterface
11
+				 */
12
+				private $client;
13 13
 
14
-    /**
15
-     * PackagistApi constructor.
16
-     * @param HttpClientInterface $client
17
-     */
18
-    public function __construct(HttpClientInterface $client)
19
-    {
20
-        $this->client = $client;
21
-    }
14
+				/**
15
+				 * PackagistApi constructor.
16
+				 * @param HttpClientInterface $client
17
+				 */
18
+				public function __construct(HttpClientInterface $client)
19
+				{
20
+								$this->client = $client;
21
+				}
22 22
 
23
-    /**
24
-     * @param string $package_name
25
-     * @return false|mixed
26
-     */
27
-    public function getPackageInformation(string $package_name)
28
-    {
29
-        if ($this->package_info) {
30
-            return $this->package_info;
31
-        }
23
+				/**
24
+				 * @param string $package_name
25
+				 * @return false|mixed
26
+				 */
27
+				public function getPackageInformation(string $package_name)
28
+				{
29
+								if ($this->package_info) {
30
+												return $this->package_info;
31
+								}
32 32
 
33
-        if (!strpos($package_name, "/")) {
34
-            return false;
35
-        }
33
+								if (!strpos($package_name, "/")) {
34
+												return false;
35
+								}
36 36
 
37
-        $packgist_url = "https://repo.packagist.org/p/".$package_name.".json";
38
-        $response = $this->client->request("GET", $packgist_url);
37
+								$packgist_url = "https://repo.packagist.org/p/".$package_name.".json";
38
+								$response = $this->client->request("GET", $packgist_url);
39 39
 
40
-        if ($response->getStatusCode() == 200) {
41
-            $content = json_decode($response->getContent(), true);
42
-            if (is_array($content) && $content["packages"] && $content["packages"][$this->package->getPackageName()]) {
43
-                $this->package_info = $content["packages"][$this->package->getPackageName()];
44
-                return $this->package_info;
45
-            }
46
-        }
40
+								if ($response->getStatusCode() == 200) {
41
+												$content = json_decode($response->getContent(), true);
42
+												if (is_array($content) && $content["packages"] && $content["packages"][$this->package->getPackageName()]) {
43
+																$this->package_info = $content["packages"][$this->package->getPackageName()];
44
+																return $this->package_info;
45
+												}
46
+								}
47 47
 
48
-        return false;
49
-    }
48
+								return false;
49
+				}
50 50
 
51
-    /**
52
-     * @param string $package_name
53
-     * @return false|int|string|null
54
-     */
55
-    public function getLastPackagistVersion(string $package_name)
56
-    {
57
-        if (!strpos($package_name, "/")) {
58
-            return false;
59
-        }
51
+				/**
52
+				 * @param string $package_name
53
+				 * @return false|int|string|null
54
+				 */
55
+				public function getLastPackagistVersion(string $package_name)
56
+				{
57
+								if (!strpos($package_name, "/")) {
58
+												return false;
59
+								}
60 60
 
61
-        $packgist_url = "https://repo.packagist.org/p/".$package_name.".json";
61
+								$packgist_url = "https://repo.packagist.org/p/".$package_name.".json";
62 62
 
63
-        $response = $this->client->request("GET", $packgist_url);
63
+								$response = $this->client->request("GET", $packgist_url);
64 64
 
65
-        if ($response->getStatusCode() == 200) {
66
-            $content = json_decode($response->getContent(), true);
67
-            if (is_array($content) && $content["packages"] && $content["packages"][$this->package->getPackageName()]) {
68
-                return array_key_first($content["packages"][$this->package->getPackageName()]);
69
-            }
70
-        }
71
-    }
65
+								if ($response->getStatusCode() == 200) {
66
+												$content = json_decode($response->getContent(), true);
67
+												if (is_array($content) && $content["packages"] && $content["packages"][$this->package->getPackageName()]) {
68
+																return array_key_first($content["packages"][$this->package->getPackageName()]);
69
+												}
70
+								}
71
+				}
72 72
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
             return false;
35 35
         }
36 36
 
37
-        $packgist_url = "https://repo.packagist.org/p/".$package_name.".json";
37
+        $packgist_url = "https://repo.packagist.org/p/" . $package_name . ".json";
38 38
         $response = $this->client->request("GET", $packgist_url);
39 39
 
40 40
         if ($response->getStatusCode() == 200) {
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
             return false;
59 59
         }
60 60
 
61
-        $packgist_url = "https://repo.packagist.org/p/".$package_name.".json";
61
+        $packgist_url = "https://repo.packagist.org/p/" . $package_name . ".json";
62 62
 
63 63
         $response = $this->client->request("GET", $packgist_url);
64 64
 
Please login to merge, or discard this patch.
Controller/PackagesDistController.php 1 patch
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -13,52 +13,52 @@
 block discarded – undo
13 13
 
14 14
 class PackagesDistController extends AbstractController
15 15
 {
16
-    /**
17
-     * @Route("/packages/send-package/{package_name}", name="ribsadmin_packages_send", requirements={"package_name"=".+"})
18
-     * @param EntityManagerInterface $em
19
-     * @param Version $version
20
-     * @param string $package_name
21
-     * @return mixed|null
22
-     * @throws Exception
23
-     */
24
-    public function sendPackageInformations(EntityManagerInterface $em, Version $version, string $package_name): JsonResponse
25
-    {
26
-        $package = $em->getRepository(Package::class)->findOneBy(["package_name" => $package_name]);
16
+				/**
17
+				 * @Route("/packages/send-package/{package_name}", name="ribsadmin_packages_send", requirements={"package_name"=".+"})
18
+				 * @param EntityManagerInterface $em
19
+				 * @param Version $version
20
+				 * @param string $package_name
21
+				 * @return mixed|null
22
+				 * @throws Exception
23
+				 */
24
+				public function sendPackageInformations(EntityManagerInterface $em, Version $version, string $package_name): JsonResponse
25
+				{
26
+								$package = $em->getRepository(Package::class)->findOneBy(["package_name" => $package_name]);
27 27
 
28
-        if ($package) {
29
-            $version->setPackageEntity($package);
30
-        }
28
+								if ($package) {
29
+												$version->setPackageEntity($package);
30
+								}
31 31
 
32
-        return new JsonResponse([
33
-            "package" => $version->getPackage(),
34
-            "package_date" => $version->getVersionDate()
35
-        ]);
36
-    }
32
+								return new JsonResponse([
33
+												"package" => $version->getPackage(),
34
+												"package_date" => $version->getVersionDate()
35
+								]);
36
+				}
37 37
 
38
-    /**
39
-     * @Route("/packages/send-composer-lock/", name="ribsadmin_packages_send_composer_lock")
40
-     * @return JsonResponse
41
-     */
42
-    public function sendComposerJson(): JsonResponse
43
-    {
44
-        $composer_lock = file_get_contents('../composer.lock');
38
+				/**
39
+				 * @Route("/packages/send-composer-lock/", name="ribsadmin_packages_send_composer_lock")
40
+				 * @return JsonResponse
41
+				 */
42
+				public function sendComposerJson(): JsonResponse
43
+				{
44
+								$composer_lock = file_get_contents('../composer.lock');
45 45
 
46
-        if ($composer_lock) {
47
-            $composer_lock = json_decode($composer_lock);
48
-        }
46
+								if ($composer_lock) {
47
+												$composer_lock = json_decode($composer_lock);
48
+								}
49 49
 
50
-        return new JsonResponse($composer_lock);
51
-    }
50
+								return new JsonResponse($composer_lock);
51
+				}
52 52
 
53
-    /**
54
-     * @Route("/packages/send-token/", name="ribsadmin_packages_send_token")
55
-     * @param ParameterBagInterface $parameter
56
-     * @return JsonResponse
57
-     */
58
-    public function sendToken(ParameterBagInterface $parameter): JsonResponse
59
-    {
60
-        return new JsonResponse([
61
-            "token" => $parameter->get("ribs_admin.packages_token")
62
-        ]);
63
-    }
53
+				/**
54
+				 * @Route("/packages/send-token/", name="ribsadmin_packages_send_token")
55
+				 * @param ParameterBagInterface $parameter
56
+				 * @return JsonResponse
57
+				 */
58
+				public function sendToken(ParameterBagInterface $parameter): JsonResponse
59
+				{
60
+								return new JsonResponse([
61
+												"token" => $parameter->get("ribs_admin.packages_token")
62
+								]);
63
+				}
64 64
 }
Please login to merge, or discard this patch.