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

        $data = [
            'id'                  => $return['id'],
            'name'                => $return['name'],
            'firstName'           => $return['first_name'],
            'lastName'            => $return['last_name'],
            'facebookProfileLink' => $return['link'],
            'username'            => $return['username'],
            'email'               => $return['email'],
            'timezone'            => $return['timezone'],
            'locale'              => $return['locale'],
            'verified'            => $return['verified'],
            'gender'              => false,
            'avatar'              => false,
            'gravatar'            => false,
            'emailVerified'       => true,
            'isSilhouette'        => true
        ];

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

        $response = $this->httpRequest(
            'https://graph.facebook.com',
            '/'.$return['id'].'/?fields=picture.type(large)'
        );

        if ($response->isOk()) {
            $graph = json_decode($response->getContent());
            $data['avatar'] = $graph->picture->data->url;
            $data['issilhouette'] = $graph->picture->data->is_silhouette;
        }

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

        $data = [
            'id'                  => $return['id'],
            'name'                => $return['name'],
            'firstName'           => $return['first_name'],
            'lastName'            => $return['last_name'],
            'facebookProfileLink' => $return['link'],
            'username'            => $return['username'],
            'email'               => $return['email'],
            'timezone'            => $return['timezone'],
            'locale'              => $return['locale'],
            'verified'            => $return['verified'],
            'gender'              => false,
            'avatar'              => false,
            'gravatar'            => false,
            'emailVerified'       => true,
            'isSilhouette'        => true
        ];

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

        $response = $this->httpRequest(
            'https://graph.facebook.com',
            '/'.$return['id'].'/?fields=picture.type(large)'
        );

        if ($response->isOk()) {
            $graph = json_decode($response->getContent());
            $data['avatar'] = $graph->picture->data->url;
            $data['issilhouette'] = $graph->picture->data->is_silhouette;
        }

        return $data;
    }
public function normalizeFacebook ( $ return ) { $ genders = [ 'male' => 'M' , 'female' => 'F' ] ; $ data = [ 'id' => $ return [ 'id' ] , 'name' => $ return [ 'name' ] , 'firstName' => $ return [ 'first_name' ] , 'lastName' => $ return [ 'last_name' ] , 'facebookProfileLink' => $ return [ 'link' ] , 'username' => $ return [ 'username' ] , 'email' => $ return [ 'email' ] , 'timezone' => $ return [ 'timezone' ] , 'locale' => $ return [ 'locale' ] , 'verified' => $ return [ 'verified' ] , 'gender' => false , 'avatar' => false , 'gravatar' => false , 'emailVerified' => true , 'isSilhouette' => true ] ; if ( isset ( $ return [ 'gender' ] ) ) { $ data [ 'gender' ] = $ genders [ $ return [ 'gender' ] ] ; } $ response = $ this -> httpRequest ( 'https://graph.facebook.com' , '/' . $ return [ 'id' ] . '/?fields=picture.type(large)' ) ; if ( $ response -> isOk ( ) ) { $ graph = json_decode ( $ response -> getContent ( ) ) ; $ data [ 'avatar' ] = $ graph -> picture -> data -> url ; $ data [ 'issilhouette' ] = $ graph -> picture -> data -> is_silhouette ; } return $ data ; }
Mapping data from facbook

@todo replace Buzz with Guzzle

@param Reponse $response

@return array contains normalized user data
Mapping data from facbook