| @@ -40,7 +40,9 @@ | ||
| 40 | 40 | public function getJSON(): ?array | 
| 41 | 41 |      { | 
| 42 | 42 | $data = json_decode($this->result, true); | 
| 43 | - if (!is_array($data)) return null; | |
| 43 | +        if (!is_array($data)) { | |
| 44 | + return null; | |
| 45 | + } | |
| 44 | 46 | |
| 45 | 47 | return $data; | 
| 46 | 48 | } | 
| @@ -17,7 +17,7 @@ discard block | ||
| 17 | 17 | $randomString = ''; | 
| 18 | 18 | |
| 19 | 19 |          for ($i = 0; $i < $length; $i++) { | 
| 20 | - $randomString .= $characters[rand(0, $charactersLength - 1)]; | |
| 20 | + $randomString .= $characters[rand(0, $charactersLength-1)]; | |
| 21 | 21 | } | 
| 22 | 22 | |
| 23 | 23 | return $randomString; | 
| @@ -29,6 +29,6 @@ discard block | ||
| 29 | 29 | */ | 
| 30 | 30 | public static function pack(string $str): string | 
| 31 | 31 |      { | 
| 32 | -        return rtrim(strtr(base64_encode(pack('H*',  hash('sha256', $str))), '+/', '-_'), '='); | |
| 32 | +        return rtrim(strtr(base64_encode(pack('H*', hash('sha256', $str))), '+/', '-_'), '='); | |
| 33 | 33 | } | 
| 34 | 34 | } | 
| @@ -45,7 +45,9 @@ | ||
| 45 | 45 | public function __get(string $service): ?ApiService | 
| 46 | 46 |      { | 
| 47 | 47 | $obj = ServiceFactory::inst($this, $service); | 
| 48 | -        if (!$obj) throw new BadMethodException("Service for `{$service}` does not exist"); | |
| 48 | +        if (!$obj) { | |
| 49 | +            throw new BadMethodException("Service for `{$service}` does not exist"); | |
| 50 | + } | |
| 49 | 51 | |
| 50 | 52 | return $obj; | 
| 51 | 53 | } | 
| @@ -2,7 +2,7 @@ discard block | ||
| 2 | 2 | |
| 3 | 3 | namespace Lifeboat; | 
| 4 | 4 | |
| 5 | -require_once __DIR__ . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'functions.php'; | |
| 5 | +require_once __DIR__.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR.'functions.php'; | |
| 6 | 6 | |
| 7 | 7 | use Lifeboat\Exceptions\BadMethodException; | 
| 8 | 8 | use Lifeboat\Exceptions\OAuthException; | 
| @@ -165,7 +165,7 @@ discard block | ||
| 165 | 165 | public function curl_api(string $url, string $method = 'GET', array $data = [], array $headers = []): CurlResponse | 
| 166 | 166 |      { | 
| 167 | 167 | $url = URL::is_absolute_url($url) ? $url | 
| 168 | - : 'https://' . rtrim($this->getHost(), '/') . '/' . ltrim($url, '/'); | |
| 168 | + : 'https://'.rtrim($this->getHost(), '/').'/'.ltrim($url, '/'); | |
| 169 | 169 | |
| 170 | 170 | $curl = new Curl($url, $data, $headers); | 
| 171 | 171 | |
| @@ -184,6 +184,6 @@ discard block | ||
| 184 | 184 | */ | 
| 185 | 185 | protected function auth_url(string $path): string | 
| 186 | 186 |      { | 
| 187 | - return rtrim($this->_auth_domain, '/') . '/' . ltrim($path, '/'); | |
| 187 | + return rtrim($this->_auth_domain, '/').'/'.ltrim($path, '/'); | |
| 188 | 188 | } | 
| 189 | 189 | } | 
| @@ -19,7 +19,9 @@ | ||
| 19 | 19 | public static function inst(Connector $connector, string $service): ?ApiService | 
| 20 | 20 |      { | 
| 21 | 21 | $service = strtolower($service); | 
| 22 | - if (!array_key_exists($service, ClassMap::SERVICES)) return null; | |
| 22 | +        if (!array_key_exists($service, ClassMap::SERVICES)) { | |
| 23 | + return null; | |
| 24 | + } | |
| 23 | 25 | |
| 24 | 26 | $cls = ClassMap::SERVICES[$service]; | 
| 25 | 27 | return new $cls($connector); | 
| @@ -98,7 +98,9 @@ | ||
| 98 | 98 |      { | 
| 99 | 99 | $curl = $this->getClient()->curl_api($url, 'DELETE', $params); | 
| 100 | 100 | |
| 101 | - if ($curl->isValid()) return true; | |
| 101 | +        if ($curl->isValid()) { | |
| 102 | + return true; | |
| 103 | + } | |
| 102 | 104 | |
| 103 | 105 | throw new ApiException($curl->getError()); | 
| 104 | 106 | } | 
| @@ -23,7 +23,7 @@ discard block | ||
| 23 | 23 | public function fetch(int $id): ?Customer | 
| 24 | 24 |      { | 
| 25 | 25 | /** @var Customer|null $fetch */ | 
| 26 | -        $fetch = $this->_get('api/customers/customer' . $id); | |
| 26 | +        $fetch = $this->_get('api/customers/customer'.$id); | |
| 27 | 27 | return $fetch; | 
| 28 | 28 | } | 
| 29 | 29 | |
| @@ -50,7 +50,7 @@ discard block | ||
| 50 | 50 | public function update(int $id, array $data): ?Customer | 
| 51 | 51 |      { | 
| 52 | 52 | /** @var Customer|null $post */ | 
| 53 | -        $post = $this->_post('api/customers/customer/' . $id, $data); | |
| 53 | +        $post = $this->_post('api/customers/customer/'.$id, $data); | |
| 54 | 54 | return $post; | 
| 55 | 55 | } | 
| 56 | 56 | |
| @@ -23,7 +23,7 @@ discard block | ||
| 23 | 23 | public function fetch(int $id): ?Address | 
| 24 | 24 |      { | 
| 25 | 25 | /** @var Address|null $address */ | 
| 26 | -        $address = $this->_get('api/addresses/address' . $id); | |
| 26 | +        $address = $this->_get('api/addresses/address'.$id); | |
| 27 | 27 | return $address; | 
| 28 | 28 | } | 
| 29 | 29 | |
| @@ -50,7 +50,7 @@ discard block | ||
| 50 | 50 | public function update(int $id, array $data): ?Address | 
| 51 | 51 |      { | 
| 52 | 52 | /** @var Address|null $address */ | 
| 53 | -        $address = $this->_post('api/addresses/address/' . $id, $data); | |
| 53 | +        $address = $this->_post('api/addresses/address/'.$id, $data); | |
| 54 | 54 | return $address; | 
| 55 | 55 | } | 
| 56 | 56 | |
| @@ -59,7 +59,9 @@ | ||
| 59 | 59 | */ | 
| 60 | 60 | public function Customer(): ?Customer | 
| 61 | 61 |      { | 
| 62 | - if (!$this->CustomerID) return null; | |
| 62 | +        if (!$this->CustomerID) { | |
| 63 | + return null; | |
| 64 | + } | |
| 63 | 65 | |
| 64 | 66 | /** @var Customer|null $customer */ | 
| 65 | 67 | $customer = $this->getClient()->customers->fetch($this->CustomerID); | 
| @@ -62,7 +62,7 @@ | ||
| 62 | 62 | $t = $this->getItems(); | 
| 63 | 63 | $c = $this->count(); | 
| 64 | 64 | |
| 65 | -        return (function () use ($t, $c) { | |
| 65 | +        return (function() use ($t, $c) { | |
| 66 | 66 | $i = 0; | 
| 67 | 67 | |
| 68 | 68 |              while ($i < $c) { | 
| @@ -42,7 +42,9 @@ discard block | ||
| 42 | 42 | |
| 43 | 43 |              foreach ($list as $item) { | 
| 44 | 44 | $obj = ObjectFactory::make($this->getClient(), $item); | 
| 45 | - if (!$obj) continue; | |
| 45 | +                if (!$obj) { | |
| 46 | + continue; | |
| 47 | + } | |
| 46 | 48 | |
| 47 | 49 | $this->_items[] = $obj; | 
| 48 | 50 | } | 
| @@ -76,6 +78,8 @@ discard block | ||
| 76 | 78 | */ | 
| 77 | 79 | public function first(): ?Model | 
| 78 | 80 |      { | 
| 79 | - foreach ($this as $obj) return $obj; | |
| 81 | +        foreach ($this as $obj) { | |
| 82 | + return $obj; | |
| 83 | + } | |
| 80 | 84 | } | 
| 81 | 85 | } |