Completed
Push — master ( 508240...149fba )
by Vasily
03:46
created

ClassWatchdog   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __call() 0 3 1
A __callStatic() 0 3 1
1
<?php
2
namespace PHPDaemon\Traits;
3
4
use PHPDaemon\Core\Daemon;
5
use PHPDaemon\Core\Debug;
6
use PHPDaemon\Exceptions\UndefinedMethodCalled;
7
8
/**
9
 * Watchdog of __call and __callStatic
10
 * @package PHPDaemon\Traits
11
 * @author  Zorin Vasily <[email protected]>
12
 */
13
trait ClassWatchdog {
14
	/**
15
	 * @param  string $method Method name
16
	 * @param  array  $args   Arguments
17
	 * @throws UndefinedMethodCalled if call to undefined method
18
	 * @return mixed
19
	 */
20
	public function __call($method, $args) {
21
		throw new UndefinedMethodCalled('Call to undefined method ' . get_class($this) . '->' . $method);
22
	}
23
24
	/**
25
	 * @param  string $method Method name
26
	 * @param  array  $args   Arguments
27
	 * @throws UndefinedMethodCalled if call to undefined static method
28
	 * @return mixed
29
	 */
30
	public static function __callStatic($method, $args) {
0 ignored issues
show
Unused Code introduced by
The parameter $args is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
31
		throw new UndefinedMethodCalled('Call to undefined static method ' . get_called_class() . '::' . $method);
32
	}
33
}
34