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

StaticObjectWatchdog::__unset()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 4
rs 10
cc 1
eloc 3
nc 1
nop 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