public function normalizeGoogle($return)
    {
        $genders = [
            'male'   => 'M',
            'female' => 'F'
        ];

        $data = [
            'id'            => $return['id'],
            'name'          => $this->ensureUtf8($return['name']),
            'firstName'     => $this->ensureUtf8($return['given_name']),
            'lastName'      => $this->ensureUtf8($return['family_name']),
            'username'      => $this->ensureUtf8($return['id']),
            'email'         => $return['email'],
            'emailVerified' => $return['verified_email'],
            'gender'        => null,
            'locale'        => null,
            'timezone'      => null,
            'avatar'        => null,
            'gravatar'      => null,
            'isSilhouette'  => true,
        ];

        if (isset($return['gender'])) {
            $data['gender'] = $genders[$return['gender']];
        }

        if (isset($return['locale'])) {
            $data['locale'] = str_replace('-', '_', $return['locale']);
        }

        if (isset($return['link'])) {
            $data['googleProfileLink'] = $return['link'];
        }

        if (isset($return['picture'])) {
            $data['avatar'] = $this->ensureUtf8($return['picture']);
            $data['isSilhouette'] = false;
        }

        $data['avatar'] = strtok($data['avatar'], '?');

        return $data;
    }
public function normalizeGoogle($return)
    {
        $genders = [
            'male'   => 'M',
            'female' => 'F'
        ];

        $data = [
            'id'            => $return['id'],
            'name'          => $this->ensureUtf8($return['name']),
            'firstName'     => $this->ensureUtf8($return['given_name']),
            'lastName'      => $this->ensureUtf8($return['family_name']),
            'username'      => $this->ensureUtf8($return['id']),
            'email'         => $return['email'],
            'emailVerified' => $return['verified_email'],
            'gender'        => null,
            'locale'        => null,
            'timezone'      => null,
            'avatar'        => null,
            'gravatar'      => null,
            'isSilhouette'  => true,
        ];

        if (isset($return['gender'])) {
            $data['gender'] = $genders[$return['gender']];
        }

        if (isset($return['locale'])) {
            $data['locale'] = str_replace('-', '_', $return['locale']);
        }

        if (isset($return['link'])) {
            $data['googleProfileLink'] = $return['link'];
        }

        if (isset($return['picture'])) {
            $data['avatar'] = $this->ensureUtf8($return['picture']);
            $data['isSilhouette'] = false;
        }

        $data['avatar'] = strtok($data['avatar'], '?');

        return $data;
    }
public function normalizeGoogle ( $ return ) { $ genders = [ 'male' => 'M' , 'female' => 'F' ] ; $ data = [ 'id' => $ return [ 'id' ] , 'name' => $ this -> ensureUtf8 ( $ return [ 'name' ] ) , 'firstName' => $ this -> ensureUtf8 ( $ return [ 'given_name' ] ) , 'lastName' => $ this -> ensureUtf8 ( $ return [ 'family_name' ] ) , 'username' => $ this -> ensureUtf8 ( $ return [ 'id' ] ) , 'email' => $ return [ 'email' ] , 'emailVerified' => $ return [ 'verified_email' ] , 'gender' => null , 'locale' => null , 'timezone' => null , 'avatar' => null , 'gravatar' => null , 'isSilhouette' => true , ] ; if ( isset ( $ return [ 'gender' ] ) ) { $ data [ 'gender' ] = $ genders [ $ return [ 'gender' ] ] ; } if ( isset ( $ return [ 'locale' ] ) ) { $ data [ 'locale' ] = str_replace ( '-' , '_' , $ return [ 'locale' ] ) ; } if ( isset ( $ return [ 'link' ] ) ) { $ data [ 'googleProfileLink' ] = $ return [ 'link' ] ; } if ( isset ( $ return [ 'picture' ] ) ) { $ data [ 'avatar' ] = $ this -> ensureUtf8 ( $ return [ 'picture' ] ) ; $ data [ 'isSilhouette' ] = false ; } $ data [ 'avatar' ] = strtok ( $ data [ 'avatar' ] , '?' ) ; return $ data ; }
Mapping data from Google

@param Reponse $response

@return array contains normalized user data
Mapping data from Google