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

StaticObjectWatchdog   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __set() 0 4 1
A __unset() 0 4 1
1
<?php
2
namespace PHPDaemon\Traits;
3
4
use PHPDaemon\Core\Daemon;
5
use PHPDaemon\Core\Debug;
6
7
/**
8
 * Watchdog of __set in static objects
9
 * @package PHPDaemon\Traits
10
 * @author  Zorin Vasily <[email protected]>
11
 */
12
trait StaticObjectWatchdog {
13
	/**
14
	 * @param  string $prop
15
	 * @param  mixed  $value
16
	 * @return void
17
	 */
18
	public function __set($prop, $value) {
19
		Daemon::log('[CODE WARN] Setting undefined property ' . json_encode($prop) . ' in object of class ' . get_class($this) . PHP_EOL . Debug::backtrace());
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 153 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
20
		$this->{$prop} = $value;
21
	}
22
	/**
23
	 * @param  string $prop
24
	 * @return void
25
	 */
26
	public function __unset($prop) {
27
		Daemon::log('[CODE WARN] Unsetting property ' . json_encode($prop) . ' in object of class ' . get_class($this) . PHP_EOL . Debug::backtrace());
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 145 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
28
		unset($this->{$prop});
29
	}
30
}
31