@@ -37,6 +37,9 @@ example containing most features described below:
37
37
{
38
38
const SOME_CONST = 42;
39
39
40
+ /**
41
+ * @var string
42
+ */
40
43
private $fooBar;
41
44
42
45
/**
@@ -48,20 +51,30 @@ example containing most features described below:
48
51
}
49
52
50
53
/**
51
- * @param string $dummy Some argument description
52
- * @param array $options
54
+ * Transforms the input given as first argument.
55
+ *
56
+ * @param bool|string $dummy Some argument description
57
+ * @param array $options An options collection to be used within the transformation
53
58
*
54
- * @return string|null Transformed input
59
+ * @return string|null The transformed input
55
60
*
56
- * @throws \R untimeException
61
+ * @throws \R untimeException When an invalid option is provided
57
62
*/
58
63
private function transformText($dummy, array $options = array())
59
64
{
65
+ $defaultOptions = array(
66
+ 'some_default' => 'values',
67
+ 'another_default' => 'more values',
68
+ );
69
+
70
+ foreach ($options as $option) {
71
+ if (!in_array($option, $defaultOptions)) {
72
+ throw new \R untimeException(sprintf('Unrecognized option "%s"', $option));
73
+ }
74
+ }
75
+
60
76
$mergedOptions = array_merge(
61
- array(
62
- 'some_default' => 'values',
63
- 'another_default' => 'more values',
64
- ),
77
+ $defaultOptions,
65
78
$options
66
79
);
67
80
@@ -76,10 +89,16 @@ example containing most features described below:
76
89
77
90
return ucwords($dummy);
78
91
}
79
-
80
- throw new \R untimeException(sprintf('Unrecognized dummy option "%s"', $dummy));
81
92
}
82
93
94
+ /**
95
+ * Performs some basic check for a given value.
96
+ *
97
+ * @param mixed $value Some value to check against
98
+ * @param bool $theSwitch Some switch to control the method's flow
99
+ *
100
+ * @return bool|null The resultant check if $theSwitch isn't false, null otherwise
101
+ */
83
102
private function reverseBoolean($value = null, $theSwitch = false)
84
103
{
85
104
if (!$theSwitch) {
0 commit comments