PlanBulkSearch::create()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 10
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace hiqdev\billing\hiapi\plan\Search;
4
5
use hiapi\Core\Endpoint\BuilderFactory;
6
use hiapi\Core\Endpoint\Endpoint;
7
use hiapi\Core\Endpoint\EndpointBuilder;
8
use hiapi\endpoints\Module\Multitenant\Tenant;
9
use hiqdev\php\billing\plan\Plan;
10
11
12
final class PlanBulkSearch
13
{
14
    public function __invoke(BuilderFactory $build): Endpoint
15
    {
16
        return $this->create($build)->build();
17
    }
18
19
    public function create(BuilderFactory $build): EndpointBuilder
20
    {
21
        return $build->endpoint(self::class)
22
                     ->exportTo(Tenant::ALL)
23
                     ->take(PlanSearchCommand::class)
24
                     ->checkPermission('plan.read')
25
                     ->middlewares(
26
                         $build->call(PlanBulkSearchAction::class)
27
                     )
28
                     ->return($build->many(Plan::class));
29
    }
30
}
31