File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -464,6 +464,32 @@ public static function decodeHtmlEntities($input)
464464 return static ::decodeSingleEntity ($ input );
465465 }
466466
467+ /**
468+ * Convert string to array.
469+ *
470+ * @param null|array|string $data
471+ * @param string $separator
472+ *
473+ * @return array
474+ */
475+ public static function convertStringToArray ($ data , $ separator = ', ' )
476+ {
477+ if (empty ($ data )) {
478+ return [];
479+ }
480+
481+ if (\is_array ($ data )) {
482+ return array_map ('trim ' , $ data );
483+ }
484+
485+ return array_map ('trim ' , explode ($ separator , $ data ));
486+ }
487+
488+ public static function jsonEncodeDecode ($ data )
489+ {
490+ return json_decode (json_encode ($ data ), true );
491+ }
492+
467493 private static function getVariableType ($ val )
468494 {
469495 $ types = [
You can’t perform that action at this time.
0 commit comments