$value) { if (!empty($value)) { continue; } $placeholder = $delimiters[0] . $placeholder . $delimiters[1]; $format = preg_replace('/\[[^\[]*' . preg_quote($placeholder) . '[^\]]*\]/', '', $format); } $chars = str_split($format); $length = count($chars); for ($i = 0; $i < $length; $i ++) { if (in_array($chars[$i], ['[', ']']) && ($i == 0 || $chars[$i-1] != '\\')) { unset($chars[$i]); } } return str_replace(['\\[', '\\]'], ['[',']'], implode($chars)); } public static function getParentNamespace($namespace) { if (false === ($index = strrpos($namespace, '\\'))) { return false; } return substr($namespace, 0, $index); } }