| Total Complexity | 7 |
| Total Lines | 72 |
| Duplicated Lines | 0 % |
| Changes | 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 | */ |
||
| 47 | public function createPayment($payment) |
||
| 48 | { |
||
| 49 | return $this->getPaymentUrl($this->client->makeRequest(new CreatePaymentLink($this->config['shop_id'], $payment))); |
||
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * @param $payment |
||
| 54 | * @return mixed |
||
| 55 | */ |
||
| 56 | public function refundPayment($payment){ |
||
| 57 | return $this->client->makeRequest(new CreateRefund($this->config['shop_id'], $payment)); |
||
| 58 | } |
||
| 59 | |||
| 60 | /** |
||
| 61 | * @param $payment |
||
| 62 | * @return mixed|string |
||
| 63 | */ |
||
| 64 | public function getPaymentUrl($payment) |
||
| 74 | } |
||
| 75 | } |
||
| 76 | |||
| 77 | /** |
||
| 78 | * @param $data |
||
| 79 | * @return bool |
||
| 80 | */ |
||
| 81 | public function verifyCallback($data) |
||
| 84 | } |
||
| 85 | |||
| 86 | } |
||
| 87 |
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.