Iber\Generator\Utilities\SetGetGenerator::attributeNameToFunction PHP Method

attributeNameToFunction() public method

Converts the given string to function. Support database names (underscores)
public attributeNameToFunction ( string $prefixFunction, string $str, array $noStrip = [] ) : string
$prefixFunction string desired function prefix (get/set)
$str string attribute name
$noStrip array
return string
    public function attributeNameToFunction($prefixFunction, $str, array $noStrip = array())
    {
        // non-alpha and non-numeric characters become spaces
        $str = preg_replace('/[^a-z0-9' . implode("", $noStrip) . ']+/i', ' ', $str);
        $str = trim($str);
        // uppercase the first character of each word
        $str = ucwords($str);
        $str = str_replace(" ", "", $str);
        $str = ucfirst($str);
        return $prefixFunction . $str;
    }