Return correct case name

@param string $name
@return string Correct case name
172380
public function getItemName($name)
    {
        $lowerName = strtolower($name);
        foreach ([
             $this->classNames,
             $this->interfaceNames,
             $this->traitNames,
         ] as $source) {
            if (isset($source[$lowerName])) {
                return $source[$lowerName];
            }
        }
        return null;
    }
1129197
protected function readName($name)
    {
        $name = trim($name);
        $firstName = NULL;
        $lastName = NULL;
        preg_match('/([^,]+),([^,]+)/', $name, $matches);
        if (count($matches) > 0) {
            $lastName = trim($matches[1]);
            $firstName = isset($matches[2]) ? trim($matches[2]) : '';
        } else {
            preg_match_all('/[^\s]+/', $name, $matches);
            if (isset($matches[0])) {
                $matches = $matches[0];
            }
            if (count($matches) > 1) {
                $lastName = array_pop($matches);
                $firstName = implode(' ', $matches);
            }
            if (count($matches) == 1) {
                $firstName = $matches[0];
            }
        }
        return array('firstname' => $firstName, 'lastname' => $lastName);
    }
1215827
public function get(string $name): string
    {
        $name = strtolower($name);
        return isset($this->headers[$name]) ? $this->headers[$name] : '';
    }
544664
private function modifyName($name)
    {
        if (!$this->caseSensitive) {
            $name = strtolower($name);
        }
        if ($this->handleDirSep) {
            if (strpos('\\', $name) !== false) {
                $name = str_replace('\\', '/', $name);
            }
        }

        return $name;
    }
723374
public function getProcessByName($name)
    {
        foreach ($this->processes as $process) {
            if ($process->name() == $name) {
                return $process;
            }
        }

        return null;
    }
561566
public function getFullName($name)
    {
        $prefix = $this->getPrefix();
        if (strlen($prefix) && false === strpos($name, $prefix)) {
            return $prefix . $name;
        }

        return $name;
    }
660627
public function getClassName(string $name) : string
    {
        $name = str_replace("/", "\\", $name);
        $name = explode("\\", $name);
        $name = array_pop($name);
        $name = $this->removeNoneAlpherNumeric($name);
        return $name;
    }
904698
public static function toUnderScoreCase($name, $toLower = true)
    {
        $result = trim(preg_replace('/[A-Z]/', '_\0', $name), '_');
        if($toLower)
        {
            $result = strtolower($result);
        }
        return $result;
    }
152213
public function fileNameCaseConvention($name, $case = 'studly')
    {
        if (is_array($case)) {
            $case = data_get($case, 'case', 'studly');
        }

        switch ($case) {
            case 'studly':
                return studly_case($name);
            case 'lower':
                return strtolower($name);
            case 'upper':
                return strtoupper($name);
            case 'snake':
                return snake_case($name);
            case 'title':
                return title_case($name);
            case 'camel':
                return camel_case($name);
            case 'kebab':
                return kebab_case($name);
        }
        
        return $name;
    }
1151726
protected function getName($name)
    {
        $renames = $this->getRenames();

        if (isset($renames[$name])) {
            return $renames[$name];
        }
        return $name;
    }
1194177
public function name($name)
    {
        $nameWithArea = !is_null($area         = area()) ? $area . '.' . $name : $name;
        return parent::name($nameWithArea);
    }
800484
public static function toPreserveCase($name)
    {
        $params = explode('-', $name);
        $newName = [];
        foreach ($params as $param) {
            $newName[] = ucwords($param);
        }
        return implode('-', $newName);
    }
961767
public function nestedName($name)
    {
        if (!is_string($name)) {
            throw new InvalidArgumentException('nestedName name must string.');
        }
        $nestedTypes = $this->nestedTypes($name);

        if ($nestedTypes === false) {
            return $name;
        }
        return mb_substr($name, 0, mb_strlen($name) - mb_strlen($nestedTypes[count($nestedTypes) - 1]));
    }
14354
public static function toUnder($name)
    {
        $name = preg_replace_callback('@[A-Z]@', function ($m) {
            return '_' . strtolower($m[0]);
        }, $name);
        $name = ltrim($name, '_');
        return $name;
    }
706035
protected function getMethod($name) 
    {
        if (isset(self::$_methods[$name])) {
            return $name;
        }

        if (isset(self::$_methods['str_'.$name])) {
            return 'str_'.$name;
        }
        
        $unspaced = str_replace('_', '', $name);
        
        if (isset(self::$_methods[$unspaced])) {
            return $unspaced;
        }
        
        if (isset(self::$_methods['str'.$unspaced])) {
            return 'str'.$unspaced;
        }
        
        $uncamel = strtolower(preg_replace("/([A-Z])/", "_$1", $name));

        if (isset(self::$_methods[$uncamel])) {
            return $uncamel;
        }

        if (isset(self::$_methods['str_'.$uncamel])) {
            return 'str_'.$uncamel;
        }
        
        $unspaced = str_replace('_', '', $uncamel);
        
        if (isset(self::$_methods[$unspaced])) {
            return $unspaced;
        }
        
        if (isset(self::$_methods['str'.$unspaced])) {
            return 'str'.$unspaced;
        }

        return $name;
    }
149213
public function p($name)
    {
        $msg = $this->raw($name);
        if (!$msg) {
            return '';
        }
        return sprintf($this->format, $msg);
    }
1323980
private function getFullQualifiedAssetName($name)
    {
        $name = $this->getUnquotedAssetName($name);

        if (strpos($name, '.') === false) {
            $name = $this->getName() . '.' . $name;
        }

        return strtolower($name);
    }