Braintree\Util::attributesToString PHP Method

attributesToString() public static method

public static attributesToString ( $attributes )
    public static function attributesToString($attributes)
    {
        $printableAttribs = [];
        foreach ($attributes as $key => $value) {
            if (is_array($value)) {
                $pAttrib = self::attributesToString($value);
            } else {
                if ($value instanceof DateTime) {
                    $pAttrib = $value->format(DateTime::RFC850);
                } else {
                    $pAttrib = $value;
                }
            }
            $printableAttribs[$key] = sprintf('%s', $pAttrib);
        }
        return self::implodeAssociativeArray($printableAttribs);
    }

Usage Example

Example #1
0
 /**
  * create a printable representation of the object as:
  * ClassName[property=value, property=value]
  * @ignore
  * @return string
  */
 public function __toString()
 {
     $output = Util::attributesToString($this->_attributes);
     if (isset($this->_creditCardVerification)) {
         $output .= sprintf('%s', $this->_creditCardVerification);
     }
     return __CLASS__ . '[' . $output . ']';
 }
All Usage Examples Of Braintree\Util::attributesToString