public static function create(FaceResponse $response)
 {
     $data = $response->getDecodedBody();
     $code = $data->error_code;
     $message = static::formatMessage($data->error);
     switch ($code) {
         case 1001:
             return new static($response, new FaceInternalException($message, $code));
         case 1004:
         case 1005:
             return new static($response, new FaceArgumentException($message, $code));
         case 1202:
             return new static($response, new FaceServerException($message, $code));
         case 1003:
             return new static($response, new FaceAuthorizationException($message, $code));
     }
     // All others
     return new static($response, new FaceOtherException($message, $code));
 }
예제 #2
0
 /**
  * Init this Graph object.
  *
  * @param FaceResponse $response The response entity from Graph.
  */
 public function __construct(FaceResponse $response)
 {
     $this->response = $response;
     $this->decodedBody = $response->getDecodedBody();
 }