@@ -7,9 +7,6 @@ abstract class BaseHandler
77 /**
88 * Returns a single value from the handler, if stored.
99 *
10- * @param string $class
11- * @param string $property
12- *
1310 * @return mixed
1411 */
1512 abstract public function get (string $ class , string $ property );
@@ -19,8 +16,7 @@ abstract public function get(string $class, string $property);
1916 * MUST override this method to provide that functionality.
2017 * Not all Handlers will support writing values.
2118 *
22- * @param string $property
23- * @param mixed $value
19+ * @param mixed $value
2420 *
2521 * @return mixed
2622 */
@@ -35,12 +31,12 @@ public function set(string $class, string $property, $value = null)
3531 *
3632 * @param mixed $value
3733 *
38- * @return string| mixed
34+ * @return mixed|string
3935 */
4036 protected function prepareValue ($ value )
4137 {
4238 if (is_bool ($ value )) {
43- return (int )$ value ;
39+ return (int ) $ value ;
4440 }
4541
4642 if (is_array ($ value ) || is_object ($ value )) {
@@ -57,7 +53,7 @@ protected function prepareValue($value)
5753 *
5854 * @param mixed $value
5955 *
60- * @return boolean |mixed
56+ * @return bool |mixed
6157 */
6258 protected function parseValue ($ value , string $ type )
6359 {
@@ -76,10 +72,8 @@ protected function parseValue($value, string $type)
7672 *
7773 * Taken from Wordpress core functions.
7874 *
79- * @param mixed $data
80- * @param boolean $strict Whether to be strict about the end of the string.
81- *
82- * @return boolean
75+ * @param mixed $data
76+ * @param bool $strict Whether to be strict about the end of the string.
8377 */
8478 protected function isSerialized ($ data , $ strict = true ): bool
8579 {
@@ -118,6 +112,7 @@ protected function isSerialized($data, $strict = true): bool
118112 }
119113 }
120114 $ token = $ data [0 ];
115+
121116 switch ($ token ) {
122117 case 's ' :
123118 if ($ strict ) {
@@ -128,15 +123,19 @@ protected function isSerialized($data, $strict = true): bool
128123 return false ;
129124 }
130125 // Or else fall through.
126+ // no break
131127 case 'a ' :
132128 case 'O ' :
133129 return (bool ) preg_match ("/^ {$ token }:[0-9]+:/s " , $ data );
130+
134131 case 'b ' :
135132 case 'i ' :
136133 case 'd ' :
137134 $ end = $ strict ? '$ ' : '' ;
138- return (bool ) preg_match ("/^ {$ token }:[0-9.E+-]+; $ end/ " , $ data );
135+
136+ return (bool ) preg_match ("/^ {$ token }:[0-9.E+-]+; {$ end }/ " , $ data );
139137 }
138+
140139 return false ;
141140 }
142141}
0 commit comments