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

CaptureAction::execute()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 9
rs 10
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