@@ -40,6 +40,8 @@ short example containing most features described below::
40
40
41
41
namespace Acme;
42
42
43
+ use Other\Qux;
44
+
43
45
/**
44
46
* Coding standards demonstration.
45
47
*/
@@ -52,12 +54,15 @@ short example containing most features described below::
52
54
*/
53
55
private $fooBar;
54
56
57
+ private $qux;
58
+
55
59
/**
56
60
* @param string $dummy Some argument description
57
61
*/
58
- public function __construct($dummy)
62
+ public function __construct($dummy, Qux $qux )
59
63
{
60
64
$this->fooBar = $this->transformText($dummy);
65
+ $this->qux = $qux;
61
66
}
62
67
63
68
/**
@@ -89,9 +94,9 @@ short example containing most features described below::
89
94
'another_default' => 'more values',
90
95
];
91
96
92
- foreach ($options as $option ) {
93
- if (!in_array($option , $defaultOptions)) {
94
- throw new \RuntimeException(sprintf('Unrecognized option "%s"', $option ));
97
+ foreach ($options as $name => $value ) {
98
+ if (!array_key_exists($name , $defaultOptions)) {
99
+ throw new \RuntimeException(sprintf('Unrecognized option "%s"', $name ));
95
100
}
96
101
}
97
102
@@ -101,33 +106,34 @@ short example containing most features described below::
101
106
);
102
107
103
108
if (true === $dummy) {
104
- return null ;
109
+ return 'something' ;
105
110
}
106
111
107
- if ('string' === $dummy) {
112
+ if (is_string( $dummy) ) {
108
113
if ('values' === $mergedOptions['some_default']) {
109
114
return substr($dummy, 0, 5);
110
115
}
111
116
112
117
return ucwords($dummy);
113
118
}
119
+
120
+ return null;
114
121
}
115
122
116
123
/**
117
- * Performs some basic check for a given value.
124
+ * Performs some basic operations for a given value.
118
125
*
119
- * @param mixed $value Some value to check against
126
+ * @param mixed $value Some value to operate against
120
127
* @param bool $theSwitch Some switch to control the method's flow
121
- *
122
- * @return bool|void The resultant check if $theSwitch isn't false, void otherwise
123
128
*/
124
- private function reverseBoolean ($value = null, $theSwitch = false)
129
+ private function performOperations ($value = null, $theSwitch = false)
125
130
{
126
131
if (!$theSwitch) {
127
132
return;
128
133
}
129
134
130
- return !$value;
135
+ $this->qux->doFoo($value);
136
+ $this->qux->doBar($value);
131
137
}
132
138
}
133
139
0 commit comments