Completed
Push — develop ( 0bdcf1...3b506c )
by Enea
09:31 queued 08:05
created

UncompletedOperationException::getGrantable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * Created on 18/03/18 by enea dhack.
4
 */
5
6
namespace Enea\Authorization\Exceptions;
7
8
use Enea\Authorization\Contracts\Grantable;
9
10
abstract class UncompletedOperationException extends AuthorizationException
11
{
12
    private $grantable;
13
14
    public function __construct(Grantable $grantable)
15
    {
16
        parent::__construct($this->makeMessage($grantable));
17
        $this->grantable = $grantable;
18
    }
19
20
    abstract protected function getOperationName(): string;
21
22
    public function getGrantable(): Grantable
23
    {
24
        return $this->grantable;
25
    }
26
27
    private function makeMessage(Grantable $grantable): string
28
    {
29
        return "The authorization '{$grantable->getSecretName()}' could not be {$this->getOperationName()}";
30
    }
31
}
32