for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Evilnet\Dotpay\DotpayApi;
use Evilnet\Dotpay\DotpayApi\Requests\CreatePaymentLink;
use Evilnet\Dotpay\DotpayApi\Requests\CreateRefund;
/**
* Class DotpayApi
* @package Evilnet\Dotpay\DotpayApi
*/
class DotpayApi
{
* @var
private $config;
* @var Client
private $client;
* @var Validator
private $validator;
* @var UrlCreator
private $url_creator;
* DotpayApi constructor.
* @param $config
public function __construct($config)
$this->config = $config;
$this->client = new Client($this->config['username'], $this->config['password'], $this->config['base_url']);
$this->validator = new Validator($this->config['pin']);
$this->url_creator = new UrlCreator($this->config['pin']);
}
* @param $payment
* @return mixed|string
* @throws \GuzzleHttp\Exception\GuzzleException
public function createPayment($payment)
return $this->getPaymentUrl($this->client->makeRequest(new CreatePaymentLink($this->config['shop_id'], $payment)));
* @param $operation_number
* @return mixed
* @throws \Evilnet\Dotpay\Exceptions\RequestIntegrityException
public function refundPayment($operation_number, $payment){
return $this->client->makeRequest(new CreateRefund($operation_number, $payment));
public function getPaymentUrl($payment)
switch ($this->config['api_version']) {
case 'dev':
default:
return $this->url_creator->getPaymentUrlWithCHK($payment);
break;
break
The break statement is not necessary if it is preceded for example by a return statement:
return
switch ($x) { case 1: return 'foo'; break; // This break is not necessary and can be left off. }
If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.
case
case 'legacy':
return $this->url_creator->getPaymentUrl($payment);
* @param $data
* @return bool
public function verifyCallback($data)
return $this->validator->verify($data);
The
break
statement is not necessary if it is preceded for example by areturn
statement:If you would like to keep this construct to be consistent with other
case
statements, you can safely mark this issue as a false-positive.