PayumService   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 24
ccs 0
cts 11
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A sync() 0 15 1
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