1 | <?php |
||
8 | class Verifier |
||
9 | { |
||
10 | const PAYPAL_ENDPOINT = 'https://www.paypal.com/cgi-bin/webscr'; |
||
11 | const PAYPAL_SANDBOX_ENDPOINT = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; |
||
12 | const STATUS_KEYWORD_VERIFIED = 'VERIFIED'; |
||
13 | const STATUS_KEYWORD_INVALID = 'INVALID'; |
||
14 | |||
15 | /** |
||
16 | * @var HttpClient |
||
17 | */ |
||
18 | private $httpClient; |
||
19 | |||
20 | /** |
||
21 | * @var MessageFactory |
||
22 | */ |
||
23 | private $messageFactory; |
||
24 | |||
25 | /** |
||
26 | * @var bool |
||
27 | */ |
||
28 | private $useSandbox; |
||
29 | |||
30 | public function __construct(HttpClient $httpClient, MessageFactory $messageFactory, $useSandbox = false) |
||
36 | |||
37 | /** |
||
38 | * @param array $datas |
||
39 | * |
||
40 | * @return bool |
||
41 | * |
||
42 | * @throws \UnexpectedValueException |
||
43 | */ |
||
44 | public function verify(array $datas) |
||
56 | |||
57 | /** |
||
58 | * @param array $datas |
||
59 | * |
||
60 | * @return \Psr\Http\Message\RequestInterface |
||
61 | */ |
||
62 | protected function createRequest(array $datas) |
||
68 | |||
69 | /** |
||
70 | * @return string |
||
71 | */ |
||
72 | protected function getServiceEndpoint() |
||
78 | |||
79 | private function buildQuery(array $params) |
||
107 | } |
||
108 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.