original_string: public static function factory(array $attributes)
      {
          if (!array_key_exists('object', $attributes)) {
              throw new Payplug\Exception\UnknownAPIResourceException('Missing "object" property.');
          }
  
          switch ($attributes['object']) {
              case 'payment':
                  return Payplug\Resource\Payment::fromAttributes($attributes);
              case 'refund':
                  return Payplug\Resource\Refund::fromAttributes($attributes);
              case 'installment_plan':
                  return Payplug\Resource\InstallmentPlan::fromAttributes($attributes);
          }
  
          throw new Payplug\Exception\UnknownAPIResourceException('Unknown "object" property "' . $attributes['object'] . '".');
      }
code: public static function factory(array $attributes)
      {
          if (!array_key_exists('object', $attributes)) {
              throw new Payplug\Exception\UnknownAPIResourceException('Missing "object" property.');
          }
  
          switch ($attributes['object']) {
              case 'payment':
                  return Payplug\Resource\Payment::fromAttributes($attributes);
              case 'refund':
                  return Payplug\Resource\Refund::fromAttributes($attributes);
              case 'installment_plan':
                  return Payplug\Resource\InstallmentPlan::fromAttributes($attributes);
          }
  
          throw new Payplug\Exception\UnknownAPIResourceException('Unknown "object" property "' . $attributes['object'] . '".');
      }
code_tokens: public static function factory ( array $ attributes ) { if ( ! array_key_exists ( 'object' , $ attributes ) ) { throw new Payplug \ Exception \ UnknownAPIResourceException ( 'Missing "object" property.' ) ; } switch ( $ attributes [ 'object' ] ) { case 'payment' : return Payplug \ Resource \ Payment :: fromAttributes ( $ attributes ) ; case 'refund' : return Payplug \ Resource \ Refund :: fromAttributes ( $ attributes ) ; case 'installment_plan' : return Payplug \ Resource \ InstallmentPlan :: fromAttributes ( $ attributes ) ; } throw new Payplug \ Exception \ UnknownAPIResourceException ( 'Unknown "object" property "' . $ attributes [ 'object' ] . '".' ) ; }
docstring: Tries to recompose an API Resource from its attributes. For example, when you got it from a notification.
  The API Resource must have a known 'object' property.
  
  @param   array   $attributes The attributes of the object.
  
  @return  IVerifiableAPIResource  An unsafe API Resource.
  
  @throws  Payplug\Exception\UnknownAPIResourceException When the given object is unknown.
docstring_tokens: Tries to recompose an API Resource from its attributes . For example when you got it from a notification . The API Resource must have a known object property .