Completed
Push — master ( d86698...3d0fab )
by
unknown
03:08
created

CreateStripeAccountTask::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace App\Containers\Stripe\Tasks;
4
5
use App\Containers\Stripe\Data\Repositories\StripeAccountRepository;
6
use App\Ship\Exceptions\CreateResourceFailedException;
7
use App\Ship\Parents\Tasks\Task;
8
use Exception;
9
10
class CreateStripeAccountTask extends Task
11
{
12
13
    protected $repository;
14
15
    public function __construct(StripeAccountRepository $repository)
16
    {
17
        $this->repository = $repository;
18
    }
19
20
    /**
21
     * @param array $data
22
     *
23
     * @return mixed
24
     * @throws CreateResourceFailedException
25
     */
26
    public function run(array $data)
27
    {
28
        try {
29
            return $this->repository->create($data);
30
        } catch (Exception $exception) {
31
            throw new CreateResourceFailedException();
32
        }
33
    }
34
}
35