MethodNotFoundException   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 55
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getMethod() 0 4 1
A getRepository() 0 4 1
A setRepositoryMethod() 0 9 1
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