Completed
Pull Request — master (#8)
by Klochok
15:06
created

ActionCalculate   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 3 1
A create() 0 13 1
1
<?php
2
3
namespace hiqdev\billing\hiapi\action\Calculate;
4
5
use hiapi\endpoints\Module\Multitenant\Tenant;
6
use hiapi\Core\Endpoint\BuilderFactory;
7
use hiapi\Core\Endpoint\Endpoint;
8
use hiapi\Core\Endpoint\EndpointBuilder;
9
use hiqdev\php\billing\sale\Sale;
10
use hiqdev\billing\hiapi\customer\CustomerLoader;
11
use hiqdev\billing\hiapi\plan\PlanLoader;
12
use hiqdev\billing\hiapi\target\TargetLoader;
13
14
final class ActionCalculate
15
{
16
    public function __invoke(BuilderFactory $build): Endpoint
17
    {
18
        return $this->create($build)->build();
19
    }
20
21
    public function create(BuilderFactory $build): EndpointBuilder
22
    {
23
        return $build->endpoint(self::class)
24
                     ->exportTo(Tenant::ALL)
25
                     ->take(ActionCalculateCommand::class)
26
                     ->checkPermission('action.calculate')
27
                     ->middlewares(
28
                         CustomerLoader::class,
29
                         PlanLoader::class,
30
                         TargetLoader::class,
31
                         $build->call(SaleCreateAction::class)
0 ignored issues
show
Bug introduced by
The type hiqdev\billing\hiapi\act...culate\SaleCreateAction 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...
32
                     )
33
                     ->return(Sale::class);
34
    }
35
}
36