| Total Complexity | 7 |
| Total Lines | 76 |
| Duplicated Lines | 0 % |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | class DotpayApi |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var |
||
| 16 | */ |
||
| 17 | private $config; |
||
| 18 | /** |
||
| 19 | * @var Client |
||
| 20 | */ |
||
| 21 | private $client; |
||
| 22 | /** |
||
| 23 | * @var Validator |
||
| 24 | */ |
||
| 25 | private $validator; |
||
| 26 | /** |
||
| 27 | * @var UrlCreator |
||
| 28 | */ |
||
| 29 | private $url_creator; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * DotpayApi constructor. |
||
| 33 | * @param $config |
||
| 34 | */ |
||
| 35 | public function __construct($config) |
||
| 36 | { |
||
| 37 | $this->config = $config; |
||
| 38 | $this->client = new Client($this->config['username'], $this->config['password'], $this->config['base_url']); |
||
| 39 | $this->validator = new Validator($this->config['pin']); |
||
| 40 | $this->url_creator = new UrlCreator($this->config['pin']); |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @param $payment |
||
| 45 | * @return mixed|string |
||
| 46 | * @throws \GuzzleHttp\Exception\GuzzleException |
||
| 47 | */ |
||
| 48 | public function createPayment($payment) |
||
| 49 | { |
||
| 50 | return $this->getPaymentUrl($this->client->makeRequest(new CreatePaymentLink($this->config['shop_id'], $payment))); |
||
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @param $payment |
||
| 55 | * @param $operation_number |
||
| 56 | * @return mixed |
||
| 57 | * @throws \Evilnet\Dotpay\Exceptions\RequestIntegrityException |
||
| 58 | * @throws \GuzzleHttp\Exception\GuzzleException |
||
| 59 | */ |
||
| 60 | public function refundPayment($operation_number, $payment){ |
||
| 61 | return $this->client->makeRequest(new CreateRefund($operation_number, $payment)); |
||
| 62 | } |
||
| 63 | |||
| 64 | /** |
||
| 65 | * @param $payment |
||
| 66 | * @return mixed|string |
||
| 67 | */ |
||
| 68 | public function getPaymentUrl($payment) |
||
| 78 | } |
||
| 79 | } |
||
| 80 | |||
| 81 | /** |
||
| 82 | * @param $data |
||
| 83 | * @return bool |
||
| 84 | */ |
||
| 85 | public function verifyCallback($data) |
||
| 88 | } |
||
| 89 | } |
||
| 90 |
The
breakstatement is not necessary if it is preceded for example by areturnstatement:If you would like to keep this construct to be consistent with other
casestatements, you can safely mark this issue as a false-positive.