Passed
Push — master ( ecc5ac...e92942 )
by Valentin
05:47 queued 01:06
created

Permission   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A ok() 0 9 1
A __construct() 0 2 1
A failed() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\Domain;
6
7
class Permission
8
{
9
    /** @var bool */
10
    public $ok = false;
11
12
    /** @var string */
13
    public $permission;
14
15
    /** @var int */
16
    public $code;
17
18
    /** @var string */
19
    public $message;
20
21
    protected function __construct()
22
    {
23
    }
24
25
    public static function failed(): self
26
    {
27
        return new self();
28
    }
29
30
    public static function ok(string $permission, int $code, string $message): self
31
    {
32
        $self = new self();
33
        $self->ok = true;
34
        $self->permission = $permission;
35
        $self->code = $code;
36
        $self->message = $message;
37
38
        return $self;
39
    }
40
}
41