@@ -22,7 +22,7 @@ class ArrayReader
2222 /**
2323 * @var array
2424 */
25- private $ originalArray = array () ;
25+ private $ originalArray = [] ;
2626
2727 /**
2828 * @param array $anArray
@@ -32,12 +32,7 @@ public function __construct(array $anArray)
3232 $ this ->originalArray = $ anArray ;
3333 }
3434
35- /**
36- * @param string $aPath
37- * @param int $default
38- * @return int
39- */
40- public function integerValue ($ aPath , $ default = 0 )
35+ public function integerValue (string $ aPath , int $ default = 0 ): int
4136 {
4237 $ value = $ this ->getValueFromPath ($ aPath );
4338
@@ -48,12 +43,7 @@ public function integerValue($aPath, $default = 0)
4843 return \intval ($ value );
4944 }
5045
51- /**
52- * @param string $aPath
53- * @param float $default
54- * @return float
55- */
56- public function floatValue ($ aPath , $ default = 0.0 )
46+ public function floatValue (string $ aPath , float $ default = 0.0 ): float
5747 {
5848 $ value = $ this ->getValueFromPath ($ aPath );
5949
@@ -64,12 +54,7 @@ public function floatValue($aPath, $default = 0.0)
6454 return \floatval ($ value );
6555 }
6656
67- /**
68- * @param string $aPath
69- * @param bool $default
70- * @return bool
71- */
72- public function booleanValue ($ aPath , $ default = false )
57+ public function booleanValue (string $ aPath , bool $ default = false ): bool
7358 {
7459 $ value = $ this ->getValueFromPath ($ aPath );
7560
@@ -80,12 +65,7 @@ public function booleanValue($aPath, $default = false)
8065 return (bool )$ value ;
8166 }
8267
83- /**
84- * @param string $aPath
85- * @param string $default
86- * @return string
87- */
88- public function stringValue ($ aPath , $ default = '' )
68+ public function stringValue (string $ aPath , string $ default = '' ): string
8969 {
9070 $ value = $ this ->getValueFromPath ($ aPath );
9171
@@ -96,12 +76,7 @@ public function stringValue($aPath, $default = '')
9676 return \strval ($ value );
9777 }
9878
99- /**
100- * @param string $aPath
101- * @param array $default
102- * @return array
103- */
104- public function arrayValue ($ aPath , array $ default = array ())
79+ public function arrayValue (string $ aPath , array $ default = []): array
10580 {
10681 $ value = $ this ->getValueFromPath ($ aPath );
10782
@@ -122,10 +97,10 @@ public function arrayValue($aPath, array $default = array())
12297
12398 /**
12499 * @param string $aPath
125- * @param null $default
100+ * @param mixed $default
126101 * @return mixed
127102 */
128- public function mixedValue ($ aPath , $ default = null )
103+ public function mixedValue (string $ aPath , $ default = null )
129104 {
130105 $ value = $ this ->getValueFromPath ($ aPath );
131106
@@ -136,19 +111,12 @@ public function mixedValue($aPath, $default = null)
136111 return $ value ;
137112 }
138113
139- /**
140- * @return array
141- */
142- public function toArray ()
114+ public function toArray (): array
143115 {
144116 return $ this ->originalArray ;
145117 }
146118
147- /**
148- * @param string $aPath
149- * @return array
150- */
151- protected function toPathKeys ($ aPath )
119+ protected function toPathKeys (string $ aPath ): array
152120 {
153121 $ aPath = str_replace ('\. ' , '___IamADot___ ' , $ aPath );
154122 $ parts = explode ('. ' , $ aPath );
@@ -160,7 +128,7 @@ protected function toPathKeys($aPath)
160128 * @param string $aPath
161129 * @return mixed
162130 */
163- protected function getValueFromPath ($ aPath )
131+ protected function getValueFromPath (string $ aPath )
164132 {
165133 $ pathKeys = $ this ->toPathKeys ($ aPath );
166134
0 commit comments