/** * Get label value by variable name * @param string $param * @return mixed */ public final function getLabel($param) { $labels = $this->labels(); $response = null; // maybe array-dotted declaration? if (Str::contains('.', $param)) { // not defined for all array-dotted nesting? if (Str::likeEmpty($labels[$param])) { // lets set default array label (before first dot-separation) $response = $labels[Str::firstIn($param, '.')]; } else { $response = $labels[$param]; } } else { $response = $labels[$param]; } return Str::likeEmpty($response) ? Str::replace('.', ' ', Str::splitCamelCase($param)) : $response; }