MethodNotExistingException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 39
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getJsonMessage() 0 8 1
1
<?php
2
declare(strict_types=1);
3
/**
4
 * Created by PhpStorm.
5
 * User: benedikt
6
 * Date: 1/3/18
7
 * Time: 12:43 PM
8
 */
9
10
namespace Tfboe\FmLib\Exceptions;
11
12
/**
13
 * Class MethodNotExistingException
14
 * @package Tfboe\FmLib\Exceptions
15
 */
16
class MethodNotExistingException extends AbstractException
17
{
18
//<editor-fold desc="Fields">
19
  /** @var  string */
20
  private $methodName;
21
22
  /** @var  string */
23
  private $className;
24
//</editor-fold desc="Fields">
25
//<editor-fold desc="Constructor">
26
27
  /**
28
   * MethodNotExistingException constructor.
29
   * @param string $className
30
   * @param string $methodName
31
   */
32
  public function __construct(string $className, string $methodName)
33
  {
34
    $this->className = $className;
35
    $this->methodName = $methodName;
36
    parent::__construct("An object of the class $className had no method $methodName");
37
  }
38
//</editor-fold desc="Constructor">
39
40
//<editor-fold desc="Public Methods">
41
  /**
42
   * Gets a json representation of the exception
43
   * @return array
44
   */
45
  public function getJsonMessage()
46
  {
47
    return [
48
      'message' => "Missing method in object",
49
      'className' => $this->className,
50
      'methodName' => $this->methodName
51
    ];
52
  }
53
//</editor-fold desc="Public Methods">
54
}