Passed
Branch master (cdf1df)
by smiley
02:42
created
Category
src/SettingsContainerAbstract.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -14,16 +14,16 @@  discard block
 block discarded – undo
14 14
 
15 15
 use ReflectionClass, ReflectionProperty;
16 16
 
17
-abstract class SettingsContainerAbstract implements SettingsContainerInterface{
17
+abstract class SettingsContainerAbstract implements SettingsContainerInterface {
18 18
 
19 19
 	/**
20 20
 	 * SettingsContainerAbstract constructor.
21 21
 	 *
22 22
 	 * @param iterable|null $properties
23 23
 	 */
24
-	public function __construct(iterable $properties = null){
24
+	public function __construct(iterable $properties = null) {
25 25
 
26
-		if(!empty($properties)){
26
+		if (!empty($properties)) {
27 27
 			$this->fromIterable($properties);
28 28
 		}
29 29
 
@@ -39,10 +39,10 @@  discard block
 block discarded – undo
39 39
 	protected function construct():void{
40 40
 		$traits = (new ReflectionClass($this))->getTraits();
41 41
 
42
-		foreach($traits as $trait){
42
+		foreach ($traits as $trait) {
43 43
 			$method = $trait->getShortName();
44 44
 
45
-			if(method_exists($this, $method)){
45
+			if (method_exists($this, $method)) {
46 46
 				call_user_func([$this, $trait->getShortName()]);
47 47
 			}
48 48
 		}
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
 	/**
53 53
 	 * @inheritdoc
54 54
 	 */
55
-	public function __get(string $property){
55
+	public function __get(string $property) {
56 56
 
57
-		if($this->__isset($property)){
57
+		if ($this->__isset($property)) {
58 58
 			return $this->{$property};
59 59
 		}
60 60
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	 */
67 67
 	public function __set(string $property, $value):void{
68 68
 
69
-		if(!property_exists($this, $property) || $this->isPrivate($property)){
69
+		if (!property_exists($this, $property) || $this->isPrivate($property)) {
70 70
 			return;
71 71
 		}
72 72
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	public function __unset(string $property):void{
98 98
 
99
-		if($this->__isset($property)){
99
+		if ($this->__isset($property)) {
100 100
 			unset($this->{$property});
101 101
 		}
102 102
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	public function fromIterable(iterable $properties):SettingsContainerInterface{
123 123
 
124
-		foreach($properties as $key => $value){
124
+		foreach ($properties as $key => $value) {
125 125
 			$this->__set($key, $value);
126 126
 		}
127 127
 
Please login to merge, or discard this patch.
src/SettingsContainerInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 /**
16 16
  * a generic container with magic getter and setter
17 17
  */
18
-interface SettingsContainerInterface{
18
+interface SettingsContainerInterface {
19 19
 
20 20
 	/**
21 21
 	 * Retrieve the value of $property
Please login to merge, or discard this patch.
examples/advanced.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,18 +14,18 @@  discard block
 block discarded – undo
14 14
 require_once __DIR__.'/../vendor/autoload.php';
15 15
 
16 16
 // from library #1
17
-trait SomeOptions{
17
+trait SomeOptions {
18 18
 	protected $foo;
19 19
 
20 20
 	// this method will be called in SettingsContainerAbstract::__construct() after the properties have been set
21
-	protected function SomeOptions(){
21
+	protected function SomeOptions() {
22 22
 		// just some constructor stuff...
23 23
 		$this->foo = strtoupper($this->foo);
24 24
 	}
25 25
 }
26 26
 
27 27
 // from library #2
28
-trait MoreOptions{
28
+trait MoreOptions {
29 29
 	protected $bar = 'whatever'; // provide default values
30 30
 }
31 31
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 
39 39
 // now plug the several library options together to a single object
40 40
 /** @var \chillerlan\Settings\SettingsContainerInterface $container */
41
-$container = new class ($commonOptions) extends SettingsContainerAbstract{
41
+$container = new class ($commonOptions) extends SettingsContainerAbstract {
42 42
 	use SomeOptions, MoreOptions; // ...
43 43
 };
44 44
 
Please login to merge, or discard this patch.
examples/simple.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 
14 14
 require_once __DIR__.'/../vendor/autoload.php';
15 15
 
16
-class MyContainer extends SettingsContainerAbstract{
16
+class MyContainer extends SettingsContainerAbstract {
17 17
 	protected $foo;
18 18
 	protected $bar;
19 19
 }
Please login to merge, or discard this patch.