UnsupportedCurveException::setOid()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace Mdanter\Ecc\Exception;
5
6
use Throwable;
7
8
class UnsupportedCurveException extends \RuntimeException
9
{
10
    /**
11
     * @var null|string
12
     */
13
    private $oid;
14
15
    /**
16
     * @var null|string
17
     */
18
    private $curveName;
19
20
    public function __construct(string $message = "", int $code = 0, Throwable $previous = null)
21
    {
22
        parent::__construct($message, $code, $previous);
23
    }
24
25
    public function setCurveName(string $curveName)
26
    {
27
        $this->curveName = $curveName;
28
        return $this;
29
    }
30
31
    public function setOid(string $oid)
32
    {
33
        $this->oid = $oid;
34
        return $this;
35
    }
36
37
    public function hasCurveName(): bool
38
    {
39
        return is_string($this->curveName);
40
    }
41
42
    public function hasOid(): bool
43
    {
44
        return is_string($this->oid);
45
    }
46
47
    public function getCurveName(): string
48
    {
49
        return $this->curveName;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->curveName could return the type null which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
50
    }
51
52
    public function getOid(): string
53
    {
54
        return $this->oid;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->oid could return the type null which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
55
    }
56
}
57