Skip to content

Commit 12c4183

Browse files
committed
clean
1 parent 379180f commit 12c4183

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

composer.json

+16-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
11
{
22
"name": "almalio/api-php",
3-
"description": "Almalio PHP Connector",
3+
"description": "Almalio.com API Wrapper",
4+
"license": "GPL-3.0-only",
5+
"type": "library",
6+
"keywords": ["almalio", "api", "wrapper"],
47
"require": {
5-
"ext-curl": "*"
8+
"php": ">=7.4",
9+
"ext-curl": "*",
10+
"ext-json": "*"
11+
},
12+
"require-dev": {
13+
"phpstan/phpstan": "^1.10"
14+
},
15+
"autoload": {
16+
"classmap": ["src/"]
17+
},
18+
"scripts": {
19+
"phpstan": "vendor/bin/phpstan analyse --level 5 src/"
620
}
721
}

src/Almalio.php

+5-10
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,24 @@ public function addContact(string $siteKey, array $data)
1616
return $this->post($siteKey, 'import/contact', $data);
1717
}
1818

19-
private function post(string $siteKey, string $request, array $data, array $query = [])
19+
private function post(string $siteKey, string $request, array $data)
2020
{
21-
return $this->send($siteKey, $request, $data, 'post', $query);
21+
return $this->send($siteKey, $request, $data, 'post');
2222
}
2323

24-
private function send(string $siteKey, string $request, $data, $method, array $query)
24+
private function send(string $siteKey, string $request, array $data, string $method)
2525
{
2626

2727
$urlRequest = $this->serverUrl . '/' . $request;
2828

2929
$ch = curl_init();
3030
curl_setopt($ch, CURLOPT_URL, $urlRequest);
3131
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
32-
33-
if (!is_null($method)) {
34-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, strtoupper($method));
35-
}
32+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, strtoupper($method));
3633

3734
$json_options = 0 | (PHP_VERSION_ID >= 70300 ? JSON_THROW_ON_ERROR : 0);
3835

39-
if (is_array($data)) {
40-
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data, $json_options));
41-
}
36+
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data, $json_options));
4237

4338
curl_setopt(
4439
$ch,

0 commit comments

Comments
 (0)