Skip to content

Commit 9f20a89

Browse files
committed
Improved PHPDoc
1 parent 6a73a78 commit 9f20a89

File tree

4 files changed

+38
-8
lines changed

4 files changed

+38
-8
lines changed

src/Client.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,30 @@
2020
/**
2121
* The Client is the main entry point to access the ActiveCampaign APIs.
2222
*
23-
* For create an instance of the Client you need a URL and a KEY. These parameters are specific to
24-
* your ActiveCampaign account. You can find them under Settings / Developer section of your profile.
23+
* To create an instance of the Client, you need a URL and a KEY. These parameters are specific to
24+
* your ActiveCampaign account. You can find them under the section Settings / Developer of your profile.
2525
*
2626
* @author Daniele De Nobili
2727
*/
2828
final class Client implements ClientInterface
2929
{
3030
/**
31+
* ActiveCampaign API base URL
32+
*
3133
* @var string
3234
*/
3335
private $apiUrl;
3436

3537
/**
38+
* API key for authentication
39+
*
3640
* @var string
3741
*/
3842
private $apiKey;
3943

4044
/**
45+
* Guzzle HTTP client for making requests
46+
*
4147
* @var GuzzleClientInterface
4248
*/
4349
private $guzzleClient;

src/ClientInterface.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,31 @@
1818
*/
1919
interface ClientInterface
2020
{
21+
/**
22+
* Performs an HTTP GET request
23+
*/
2124
public function get(string $path): Result;
2225

26+
/**
27+
* Performs an HTTP POST request
28+
*/
2329
public function post(string $path, array $body): Result;
2430

31+
/**
32+
* Performs an HTTP PUT request
33+
*/
2534
public function put(string $path, array $body): Result;
2635

36+
/**
37+
* Performs an HTTP DELETE request
38+
*/
2739
public function delete(string $path): Result;
2840

41+
/**
42+
* Tests the validity of API credentials
43+
*
44+
* Makes a request to the 'users/me' endpoint to verify if
45+
* the configured API credentials are valid and working.
46+
*/
2947
public function testCredentials(): bool;
3048
}

src/Result.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@
1111

1212
namespace MetaLine\ActiveCampaign;
1313

14+
/**
15+
* Result Container
16+
*
17+
* Encapsulates the result of an API call, providing access to success status,
18+
* response data, and error information. This class is returned by all Client
19+
* methods to provide a consistent interface for handling API responses.
20+
*
21+
* @author Daniele De Nobili
22+
*/
1423
final class Result
1524
{
1625
/**
@@ -40,15 +49,15 @@ public function __construct(bool $successful = true, array $result = [], array $
4049
}
4150

4251
/**
43-
* Returns true if the client response is successful, false otherwise.
52+
* Checks if the API request was successful
4453
*/
4554
public function isSuccessful(): bool
4655
{
4756
return $this->successful;
4857
}
4958

5059
/**
51-
* Returns the data returned from the client call.
60+
* Gets the response data from successful API calls
5261
*
5362
* If the result is failed, this method returns an empty array.
5463
*/
@@ -58,7 +67,7 @@ public function getData(): array
5867
}
5968

6069
/**
61-
* Returns the errors returned from the client call.
70+
* Gets the error information from failed API calls
6271
*
6372
* If the result is successful, this method returns an empty array.
6473
*/

tests/Fixture/GenericGuzzleException.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,4 @@
1414
use Exception;
1515
use GuzzleHttp\Exception\GuzzleException;
1616

17-
/**
18-
* GenericGuzzleException
19-
*/
2017
final class GenericGuzzleException extends Exception implements GuzzleException {}

0 commit comments

Comments
 (0)