PayumService::sync()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 15
ccs 0
cts 11
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 11
nc 1
nop 2
crap 2
1
<?php
2
3
namespace Recca0120\LaravelPayum\Service;
4
5
use Payum\Core\Request\Sync;
6
use Payum\Core\Request\Convert;
7
8
class PayumService
9
{
10
    /**
11
     * sync.
12
     *
13
     * @param string $gatewayName
14
     * @param callable $closure
15
     */
16
    public function sync($gatewayName, callable $closure)
17
    {
18
        $gateway = $this->getGateway($gatewayName);
0 ignored issues
show
Bug introduced by
The method getGateway() does not seem to exist on object<Recca0120\Laravel...m\Service\PayumService>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
19
        $storage = $this->getStorage();
0 ignored issues
show
Bug introduced by
The method getStorage() does not seem to exist on object<Recca0120\Laravel...m\Service\PayumService>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
20
        $payment = $storage->create();
21
        $closure($payment, $gatewayName, $storage, $this->getPayum());
0 ignored issues
show
Bug introduced by
The method getPayum() does not seem to exist on object<Recca0120\Laravel...m\Service\PayumService>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
22
23
        $request = new Sync($payment);
24
        $convert = new Convert($payment, 'array', $request->getToken());
25
        $gateway->execute($convert);
26
        $payment->setDetails($convert->getResult());
27
        $gateway->execute($request);
28
29
        return $request->getModel();
30
    }
31
}
32