57 foreach ($array as $key => $item)
59 $itemConverted =
false;
60 if ($this->format & self::VALUES)
62 if (($this->format & self::RECURSIVE) && is_array($item))
66 elseif (is_string($item))
71 $itemConverted =
true;
74 if ($this->format & self::KEYS)
81 if (($this->format & self::RECURSIVE) && is_array($item) && !$itemConverted)
87 $newData[$key] = $item;
95 if ($this->format & self::TO_SNAKE)
100 if ($this->format & self::TO_SNAKE_DIGIT)
102 $string = preg_replace(
'/(\d+)([A-Za-z])/',
'$1_$2', $string);
103 $string = preg_replace(
'/([A-Za-z])(\d)/',
'$1_$2', $string);
104 $string = preg_replace(
'/([^_])([A-Z])/',
'$1_$2', $string);
105 $string = mb_strtolower($string);
108 if ($this->format & self::TO_CAMEL)
113 if ($this->format & self::TO_LOWER)
115 $string = mb_strtolower($string);
118 if ($this->format & self::TO_UPPER)
120 $string = mb_strtoupper($string);
123 if ($this->format & self::UC_FIRST)
125 $string = ucfirst($string);
128 if ($this->format & self::LC_FIRST)
130 $string = lcfirst($string);