plugin/exo/Serializer/UserSerializer.php
public function serialize(User $user, array $options = [])
    {
        $serialized = [
            'id' => $user->getUuid(),
            'name' => trim($user->getFirstName().' '.$user->getLastName()),
            'picture' => $this->serializePicture($user),
            'firstName' => $user->getFirstName(),
            'lastName' => $user->getLastName(),
            'username' => $user->getUsername(),
            'publicUrl' => $user->getPublicUrl(),
        ];

        if (!in_array(Transfer::MINIMAL, $options)) {
            $serialized['email'] = $user->getEmail();
        }

        return $serialized;
    }
public function serialize(User $user, array $options = [])
    {
        $serialized = [
            'id' => $user->getUuid(),
            'name' => trim($user->getFirstName().' '.$user->getLastName()),
            'picture' => $this->serializePicture($user),
            'firstName' => $user->getFirstName(),
            'lastName' => $user->getLastName(),
            'username' => $user->getUsername(),
            'publicUrl' => $user->getPublicUrl(),
        ];

        if (!in_array(Transfer::MINIMAL, $options)) {
            $serialized['email'] = $user->getEmail();
        }

        return $serialized;
    }
public function serialize ( User $ user , array $ options = [ ] ) { $ serialized = [ 'id' => $ user -> getUuid ( ) , 'name' => trim ( $ user -> getFirstName ( ) . ' ' . $ user -> getLastName ( ) ) , 'picture' => $ this -> serializePicture ( $ user ) , 'firstName' => $ user -> getFirstName ( ) , 'lastName' => $ user -> getLastName ( ) , 'username' => $ user -> getUsername ( ) , 'publicUrl' => $ user -> getPublicUrl ( ) , ] ; if ( ! in_array ( Transfer :: MINIMAL , $ options ) ) { $ serialized [ 'email' ] = $ user -> getEmail ( ) ; } return $ serialized ; }
Converts a User into a JSON-encodable structure.

@param User  $user
@param array $options

@return array
Converts a User into a JSON - encodable structure .