MethodNotFoundException::getMethod()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Suitmedia\Cacheable\Exceptions;
4
5
use BadMethodCallException;
6
7
class MethodNotFoundException extends BadMethodCallException
8
{
9
    /**
10
     * Method name.
11
     *
12
     * @var string
13
     */
14
    protected $method;
15
16
    /**
17
     * Repository class name.
18
     *
19
     * @var string
20
     */
21
    protected $repository;
22
23
    /**
24
     * Get method name.
25
     *
26
     * @return string
27
     */
28
    public function getMethod()
29
    {
30
        return $this->method;
31
    }
32
33
    /**
34
     * Get the repository name.
35
     *
36
     * @return string
37
     */
38
    public function getRepository(): string
39
    {
40
        return $this->repository;
41
    }
42
43
    /**
44
     * Set Repository and method name then generate the
45
     * exception message.
46
     *
47
     * @param string $repository
48
     * @param string $method
49
     *
50
     * @return \Suitmedia\Cacheable\Exceptions\MethodNotFoundException
51
     */
52
    public function setRepositoryMethod($repository, $method): self
53
    {
54
        $this->repository = $repository;
55
        $this->method = $method;
56
57
        $this->message = "Method {$this->method}() doesn't exist in {$this->repository}";
58
59
        return $this;
60
    }
61
}
62