Example #1
0
 public static function attributesToString($attributes)
 {
     $printableAttribs = array();
     foreach ($attributes as $key => $value) {
         if (is_array($value)) {
             $pAttrib = Braintree_Util::attributesToString($value);
         } else {
             if ($value instanceof DateTime) {
                 $pAttrib = $value->format(DateTime::RFC850);
             } else {
                 $pAttrib = $value;
             }
         }
         $printableAttribs[$key] = sprintf('%s', $pAttrib);
     }
     return Braintree_Util::implodeAssociativeArray($printableAttribs);
 }
 function testimplodeAssociativeArray()
 {
     $array = array('test1' => 'val1', 'test2' => 'val2');
     $string = Braintree_Util::implodeAssociativeArray($array);
     $this->assertEquals('test1=val1, test2=val2', $string);
 }
 /**
  * create a printable representation of the object as:
  * ClassName[property=value, property=value]
  * @ignore
  * @return var
  */
 public function __toString()
 {
     $output = Braintree_Util::implodeAssociativeArray($this->_params);
     $output .= sprintf('%s', $this->_errors);
     if (isset($this->_creditCardVerification)) {
         $output .= sprintf('%s', $this->_creditCardVerification);
     }
     return __CLASS__ . '[' . $output . ']';
 }
Example #4
0
 /**
  * create a printable representation of the object as:
  * ClassName[property=value, property=value]
  * @return var
  */
 public function __toString()
 {
     $objOutput = Braintree_Util::implodeAssociativeArray($this->_attributes);
     return get_class($this) . '[' . $objOutput . ']';
 }
 /**
  * returns a string representation of the customer
  * @return string
  */
 public function __toString()
 {
     foreach ($this->_attributes as $key => $value) {
         if (is_array($value)) {
             foreach ($value as $obj) {
                 $pAttrib .= sprintf('%s', $obj);
             }
         } else {
             $pAttrib = $value;
         }
         $printableAttribs[$key] = sprintf('%s', $pAttrib);
     }
     return __CLASS__ . '[' . Braintree_Util::implodeAssociativeArray($printableAttribs) . ']';
 }
 /**
  * returns a string representation of the transaction
  * @return string
  */
 public function __toString()
 {
     // array of attributes to print
     $display = array('id', 'type', 'amount', 'status', 'createdAt', 'creditCardDetails', 'customerDetails');
     foreach ($display as $attrib) {
         if (is_array($this->{$attrib})) {
             foreach ($this->{$attrib} as $obj) {
                 $pAttrib .= sprintf('%s', $obj);
             }
         } else {
             $pAttrib = $this->{$attrib};
         }
         $printableAttribs[$attrib] = sprintf('%s', $pAttrib);
     }
     return __CLASS__ . '[' . Braintree_Util::implodeAssociativeArray($printableAttribs) . ']';
 }
Example #7
0
 function testimplodeAssociativeArray()
 {
     $array = array('test1' => 'val1', 'test2' => 'val2', 'test3' => new DateTime('2015-05-15 17:21:00'));
     $string = Braintree_Util::implodeAssociativeArray($array);
     $this->assertEquals('test1=val1, test2=val2, test3=Fri, 15 May 2015 17:21:00 +0000', $string);
 }