Passed
Push — master ( bf85fc...c1490b )
by Anthony
09:13
created
Service/PackagistApi.php 1 patch
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -11,92 +11,92 @@
 block discarded – undo
11 11
 
12 12
 class PackagistApi
13 13
 {
14
-    /**
15
-     * @var HttpClientInterface
16
-     */
17
-    private $client;
14
+				/**
15
+				 * @var HttpClientInterface
16
+				 */
17
+				private $client;
18 18
 
19
-    /**
20
-     * @var string
21
-     */
22
-    private $package_name = null;
19
+				/**
20
+				 * @var string
21
+				 */
22
+				private $package_name = null;
23 23
 
24
-    /**
25
-     * @var array
26
-     */
27
-    private $package_info = [];
24
+				/**
25
+				 * @var array
26
+				 */
27
+				private $package_info = [];
28 28
 
29
-    /**
30
-     * PackagistApi constructor.
31
-     * @param HttpClientInterface $client
32
-     */
33
-    public function __construct(HttpClientInterface $client)
34
-    {
35
-        $this->client = $client;
36
-    }
29
+				/**
30
+				 * PackagistApi constructor.
31
+				 * @param HttpClientInterface $client
32
+				 */
33
+				public function __construct(HttpClientInterface $client)
34
+				{
35
+								$this->client = $client;
36
+				}
37 37
 
38
-    /**
39
-     * @return false|mixed
40
-     * @throws ClientExceptionInterface
41
-     * @throws RedirectionExceptionInterface
42
-     * @throws ServerExceptionInterface
43
-     * @throws TransportExceptionInterface
44
-     */
45
-    private function getPackageInformation()
46
-    {
47
-        if ($this->package_info) {
48
-            return $this->package_info;
49
-        }
38
+				/**
39
+				 * @return false|mixed
40
+				 * @throws ClientExceptionInterface
41
+				 * @throws RedirectionExceptionInterface
42
+				 * @throws ServerExceptionInterface
43
+				 * @throws TransportExceptionInterface
44
+				 */
45
+				private function getPackageInformation()
46
+				{
47
+								if ($this->package_info) {
48
+												return $this->package_info;
49
+								}
50 50
 
51
-        if (!$this->package_name || !strpos($this->package_name, "/")) {
52
-            return false;
53
-        }
51
+								if (!$this->package_name || !strpos($this->package_name, "/")) {
52
+												return false;
53
+								}
54 54
 
55
-        $packgist_url = "https://repo.packagist.org/p/".$this->package_name.".json";
56
-        $response = $this->client->request("GET", $packgist_url);
55
+								$packgist_url = "https://repo.packagist.org/p/".$this->package_name.".json";
56
+								$response = $this->client->request("GET", $packgist_url);
57 57
 
58
-        if ($response->getStatusCode() == 200) {
59
-            $content = json_decode($response->getContent(), true);
60
-            if (is_array($content) && $content["packages"] && $content["packages"][$this->package_name]) {
61
-                $this->package_info = $content["packages"][$this->package_name];
62
-                return $this->package_info;
63
-            }
64
-        }
58
+								if ($response->getStatusCode() == 200) {
59
+												$content = json_decode($response->getContent(), true);
60
+												if (is_array($content) && $content["packages"] && $content["packages"][$this->package_name]) {
61
+																$this->package_info = $content["packages"][$this->package_name];
62
+																return $this->package_info;
63
+												}
64
+								}
65 65
 
66
-        return false;
67
-    }
66
+								return false;
67
+				}
68 68
 
69
-    /**
70
-     * @param string $package_name
71
-     * @return false|int|string|null
72
-     * @throws ClientExceptionInterface
73
-     * @throws RedirectionExceptionInterface
74
-     * @throws ServerExceptionInterface
75
-     * @throws TransportExceptionInterface
76
-     */
77
-    public function getLastPackagistVersion(string $package_name)
78
-    {
79
-        $this->package_name = $package_name;
80
-        if ($package = $this->getPackageInformation()) {
81
-            return array_key_first($package);
82
-        }
69
+				/**
70
+				 * @param string $package_name
71
+				 * @return false|int|string|null
72
+				 * @throws ClientExceptionInterface
73
+				 * @throws RedirectionExceptionInterface
74
+				 * @throws ServerExceptionInterface
75
+				 * @throws TransportExceptionInterface
76
+				 */
77
+				public function getLastPackagistVersion(string $package_name)
78
+				{
79
+								$this->package_name = $package_name;
80
+								if ($package = $this->getPackageInformation()) {
81
+												return array_key_first($package);
82
+								}
83 83
 
84
-        return false;
85
-    }
84
+								return false;
85
+				}
86 86
 
87
-    /**
88
-     * @param string $package_name
89
-     * @return array
90
-     * @throws ClientExceptionInterface
91
-     * @throws RedirectionExceptionInterface
92
-     * @throws ServerExceptionInterface
93
-     * @throws TransportExceptionInterface
94
-     */
95
-    public function getAllPackagistVersions(string $package_name)
96
-    {
97
-        $this->package_name = $package_name;
98
-        if ($package = $this->getPackageInformation()) {
99
-            return array_keys($package);
100
-        }
101
-    }
87
+				/**
88
+				 * @param string $package_name
89
+				 * @return array
90
+				 * @throws ClientExceptionInterface
91
+				 * @throws RedirectionExceptionInterface
92
+				 * @throws ServerExceptionInterface
93
+				 * @throws TransportExceptionInterface
94
+				 */
95
+				public function getAllPackagistVersions(string $package_name)
96
+				{
97
+								$this->package_name = $package_name;
98
+								if ($package = $this->getPackageInformation()) {
99
+												return array_keys($package);
100
+								}
101
+				}
102 102
 }
Please login to merge, or discard this patch.