Completed
Push — master ( 9526de...ac74b3 )
by Mykolas
08:12
created

CaptureAction   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 16
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 9 2
1
<?php
2
3
namespace PTS\SyliusPayseraPlugin\Action;
4
5
use WhiteCube\Lingua\Service as LocaleConverter;
0 ignored issues
show
Bug introduced by
The type WhiteCube\Lingua\Service was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Payum\Core\Bridge\Spl\ArrayObject;
7
use PTS\Paysera\Action\CaptureAction as BaseCaptureAction;
8
9
class CaptureAction extends BaseCaptureAction
10
{
11
12
    /**
13
     * @param mixed $request
14
     * @throws \WebToPayException
15
     */
16
    public function execute($request)
17
    {
18
        $model = ArrayObject::ensureArrayObject($request->getModel());
19
20
        if (!isset($model['lang'])) {
21
            $locale = LocaleConverter::create($request->getFirstModel()->getOrder()->getLocaleCode());
22
            $model['lang'] = strtoupper($locale->toIso_639_2b());
23
        }
24
        parent::execute($request);
25
    }
26
}
27