src/libs/FullNameParser.php
public function fix_case($word)
	{

		# Fix case for words split by periods (J.P.)
		if (mb_strpos($word, '.') !== false) {
			$word = $this->safe_ucfirst(".", $word);;
		}

		# Fix case for words split by hyphens (Kimura-Fay)
		if (mb_strpos($word, '-') !== false) {
			$word = $this->safe_ucfirst("-", $word);
		}

		# Special case for single letters
		if (mb_strlen($word) == 1) {
			$word = mb_strtoupper($word);
		}

		# Special case for 2-letter words
		if (mb_strlen($word) == 2) {
			# Both letters vowels (uppercase both)
			if (in_array(mb_strtolower($word{0}), $this->dict['vowels']) && in_array(mb_strtolower($word{1}), $this->dict['vowels'])) {
				$word = mb_strtoupper($word);
			}
			# Both letters consonants (uppercase both)
			if (!in_array(mb_strtolower($word{0}), $this->dict['vowels']) && !in_array(mb_strtolower($word{1}), $this->dict['vowels'])) {
				$word = mb_strtoupper($word);
			}
			# First letter is vowel, second letter consonant (uppercase first)
			if (in_array(mb_strtolower($word{0}), $this->dict['vowels']) && !in_array(mb_strtolower($word{1}), $this->dict['vowels'])) {
				$word = $this->mb_ucfirst(mb_strtolower($word));
			}
			# First letter consonant, second letter vowel or "y" (uppercase first)
			if (!in_array(mb_strtolower($word{0}), $this->dict['vowels']) && (in_array(mb_strtolower($word{1}), $this->dict['vowels']) || mb_strtolower($word{1}) == 'y')) {
				$word = $this->mb_ucfirst(mb_strtolower($word));
			}
		}

		# Fix case for words which aren't initials, but are all uppercase or lowercase
		if ((mb_strlen($word) >= 3) && ($this->mb_ctype_upper($word) || $this->mb_ctype_lower($word))) {
			$word = $this->mb_ucfirst(mb_strtolower($word));
		}

		return $word;
	}
public function fix_case($word)
	{

		# Fix case for words split by periods (J.P.)
		if (mb_strpos($word, '.') !== false) {
			$word = $this->safe_ucfirst(".", $word);;
		}

		# Fix case for words split by hyphens (Kimura-Fay)
		if (mb_strpos($word, '-') !== false) {
			$word = $this->safe_ucfirst("-", $word);
		}

		# Special case for single letters
		if (mb_strlen($word) == 1) {
			$word = mb_strtoupper($word);
		}

		# Special case for 2-letter words
		if (mb_strlen($word) == 2) {
			# Both letters vowels (uppercase both)
			if (in_array(mb_strtolower($word{0}), $this->dict['vowels']) && in_array(mb_strtolower($word{1}), $this->dict['vowels'])) {
				$word = mb_strtoupper($word);
			}
			# Both letters consonants (uppercase both)
			if (!in_array(mb_strtolower($word{0}), $this->dict['vowels']) && !in_array(mb_strtolower($word{1}), $this->dict['vowels'])) {
				$word = mb_strtoupper($word);
			}
			# First letter is vowel, second letter consonant (uppercase first)
			if (in_array(mb_strtolower($word{0}), $this->dict['vowels']) && !in_array(mb_strtolower($word{1}), $this->dict['vowels'])) {
				$word = $this->mb_ucfirst(mb_strtolower($word));
			}
			# First letter consonant, second letter vowel or "y" (uppercase first)
			if (!in_array(mb_strtolower($word{0}), $this->dict['vowels']) && (in_array(mb_strtolower($word{1}), $this->dict['vowels']) || mb_strtolower($word{1}) == 'y')) {
				$word = $this->mb_ucfirst(mb_strtolower($word));
			}
		}

		# Fix case for words which aren't initials, but are all uppercase or lowercase
		if ((mb_strlen($word) >= 3) && ($this->mb_ctype_upper($word) || $this->mb_ctype_lower($word))) {
			$word = $this->mb_ucfirst(mb_strtolower($word));
		}

		return $word;
	}
# helper public function for fix_case