src/UserInterface/FormatNameImplementation.php
public function getFirstAndLastNameFromEmail()
    {
        $exploded_full_name = explode(' ', str_replace(['.', '-', '_'], [' ', ' ', ' '], substr($this->getEmail(), 0, strpos($this->getEmail(), '@'))));

        if (count($exploded_full_name) === 1) {
            $first_name = mb_strtoupper(mb_substr($exploded_full_name[0], 0, 1)) . mb_substr($exploded_full_name[0], 1);
            $last_name = '';
        } else {
            $full_name = [];

            foreach ($exploded_full_name as $k) {
                $full_name[] = mb_strtoupper(mb_substr($k, 0, 1)) . mb_substr($k, 1);
            }

            $first_name = array_shift($full_name);
            $last_name = implode(' ', $full_name);
        }

        return [$first_name, $last_name];
    }
public function getFirstAndLastNameFromEmail()
    {
        $exploded_full_name = explode(' ', str_replace(['.', '-', '_'], [' ', ' ', ' '], substr($this->getEmail(), 0, strpos($this->getEmail(), '@'))));

        if (count($exploded_full_name) === 1) {
            $first_name = mb_strtoupper(mb_substr($exploded_full_name[0], 0, 1)) . mb_substr($exploded_full_name[0], 1);
            $last_name = '';
        } else {
            $full_name = [];

            foreach ($exploded_full_name as $k) {
                $full_name[] = mb_strtoupper(mb_substr($k, 0, 1)) . mb_substr($k, 1);
            }

            $first_name = array_shift($full_name);
            $last_name = implode(' ', $full_name);
        }

        return [$first_name, $last_name];
    }
public function getFirstAndLastNameFromEmail ( ) { $ exploded_full_name = explode ( ' ' , str_replace ( [ '.' , '-' , '_' ] , [ ' ' , ' ' , ' ' ] , substr ( $ this -> getEmail ( ) , 0 , strpos ( $ this -> getEmail ( ) , '@' ) ) ) ) ; if ( count ( $ exploded_full_name ) === 1 ) { $ first_name = mb_strtoupper ( mb_substr ( $ exploded_full_name [ 0 ] , 0 , 1 ) ) . mb_substr ( $ exploded_full_name [ 0 ] , 1 ) ; $ last_name = '' ; } else { $ full_name = [ ] ; foreach ( $ exploded_full_name as $ k ) { $ full_name [ ] = mb_strtoupper ( mb_substr ( $ k , 0 , 1 ) ) . mb_substr ( $ k , 1 ) ; } $ first_name = array_shift ( $ full_name ) ; $ last_name = implode ( ' ' , $ full_name ) ; } return [ $ first_name , $ last_name ] ; }
Try to get first and last name from email address.

@return array
Try to get first and last name from email address .