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

Permission::failed()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 3
rs 10
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