ServiceError::getMessage()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * @author    Nurlan Mukhanov <[email protected]>
4
 * @copyright 2022 Nurlan Mukhanov
5
 * @license   https://en.wikipedia.org/wiki/MIT_License MIT License
6
 * @link      https://github.com/Falseclock/service-layer
7
 */
8
9
declare(strict_types=1);
10
11
namespace Falseclock\Service;
12
13
class ServiceError
14
{
15
    public const ERROR_INVALID_REQUEST = 1000000;
16
    public const ERROR_UNEXPECTED = 1000001;
17
    /** @var int */
18
    protected $code;
19
    /** @var string */
20
    protected $message;
21
22
    public function __construct(string $message, int $code = 0)
23
    {
24
        $this->message = $message;
25
        $this->code = $code;
26
    }
27
28
    /**
29
     * @return int
30
     */
31
    public function getCode(): int
32
    {
33
        return $this->code;
34
    }
35
36
    /**
37
     * @return string
38
     */
39
    public function getMessage(): string
40
    {
41
        return $this->message;
42
    }
43
}
44