PlumTreeSystems /
PayumPayseraGateway
| 1 | <?php |
||||
| 2 | namespace PTS\Paysera; |
||||
| 3 | |||||
| 4 | use Http\Message\MessageFactory; |
||||
| 5 | use function League\Uri\create; |
||||
| 6 | use Payum\Core\Bridge\Spl\ArrayObject; |
||||
| 7 | use Payum\Core\Exception\Http\HttpException; |
||||
| 8 | use Payum\Core\HttpClientInterface; |
||||
| 9 | use Payum\Core\Reply\HttpPostRedirect; |
||||
| 10 | use Payum\Core\Reply\HttpResponse; |
||||
| 11 | use Payum\Core\Request\GetHttpRequest; |
||||
| 12 | use Symfony\Component\HttpFoundation\Request; |
||||
| 13 | use WebToPay; |
||||
| 14 | |||||
| 15 | class MockedApi |
||||
| 16 | { |
||||
| 17 | /** |
||||
| 18 | * @var array |
||||
| 19 | */ |
||||
| 20 | protected $options = []; |
||||
| 21 | |||||
| 22 | /** |
||||
| 23 | * Api constructor. |
||||
| 24 | * @param array $options |
||||
| 25 | */ |
||||
| 26 | public function __construct(array $options) |
||||
| 27 | { |
||||
| 28 | $options = ArrayObject::ensureArrayObject($options); |
||||
| 29 | $options->defaults($this->options); |
||||
| 30 | |||||
| 31 | $this->options = $options; |
||||
|
0 ignored issues
–
show
|
|||||
| 32 | } |
||||
| 33 | |||||
| 34 | public function doPayment(array $fields) |
||||
| 35 | { |
||||
| 36 | $fields['projectid'] = $this->options['projectid']; |
||||
| 37 | $fields['sign_password'] = $this->options['sign_password']; |
||||
| 38 | $this->options['test'] ? $fields['test'] = 1 : $fields['test'] = 0; |
||||
| 39 | $authorizeTokenUrl = $this->getApiEndpoint(); |
||||
| 40 | $data = WebToPay::buildRequest($fields); |
||||
| 41 | throw new HttpPostRedirect($authorizeTokenUrl, $data); |
||||
| 42 | } |
||||
| 43 | |||||
| 44 | public function doNotify(array $fields) |
||||
|
0 ignored issues
–
show
The parameter
$fields is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
|
|||||
| 45 | { |
||||
| 46 | return true; |
||||
| 47 | } |
||||
| 48 | |||||
| 49 | /** |
||||
| 50 | * @return string |
||||
| 51 | */ |
||||
| 52 | protected function getApiEndpoint() |
||||
| 53 | { |
||||
| 54 | return WebToPay::PAY_URL; |
||||
| 55 | } |
||||
| 56 | |||||
| 57 | public function getApiOptions() |
||||
| 58 | { |
||||
| 59 | return $this->options; |
||||
| 60 | } |
||||
| 61 | } |
||||
| 62 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..