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

StrictStaticObjectWatchdog   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __set() 0 3 1
A __unset() 0 3 1
1
<?php
2
namespace PHPDaemon\Traits;
3
use PHPDaemon\Core\Daemon;
4
use PHPDaemon\Core\Debug;
5
6
/**
7
 * Watchdog of __set in static objects
8
 * @package PHPDaemon\Traits
9
 * @author  Zorin Vasily <[email protected]>
10
 */
11
trait StrictStaticObjectWatchdog {
12
	/**
13
	 * @param  string $prop
14
	 * @param  mixed  $value
15
	 * @throws UndefinedPropertySetting if trying to set undefined property
16
	 * @return void
17
	 */
18
	public function __set($prop, $value) {
0 ignored issues
show
Unused Code introduced by
The parameter $value 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...
19
		throw new UndefinedPropertySetting('Trying to set undefined property ' . json_encode($prop) . ' in object of class ' . get_class($this));
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 139 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
	}
21
22
	/**
23
	 * @param  string $prop
24
	 * @throws UnsettingProperty if trying to unset property
25
	 * @return void
26
	 */
27
	public function __unset($prop) {
28
		throw new UnsettingProperty('Trying to unset property ' . json_encode($prop) . ' in object of class ' . get_class($this));
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 124 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...
29
	}
30
}
31