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

UncompletedOperationException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 0
cbo 2
dl 0
loc 22
ccs 0
cts 13
cp 0
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
getOperationName() 0 1 ?
A getGrantable() 0 4 1
A makeMessage() 0 4 1
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