public function testArrayClone() { try { Stripe_Util::arrayClone(1); $this->assertFalse(true); } catch (Stripe_Error $e) { $this->assertTrue(true); } }
private function _requestRaw($meth, $url, $params) { $myApiKey = $this->_apiKey; if (!$myApiKey) { $myApiKey = Stripe::$apiKey; } if (!$myApiKey) { throw new Stripe_AuthenticationError('No API key provided. (HINT: set your API key using "Stripe::setApiKey(<API-KEY>)". You can generate API keys from the Stripe web interface. See https://stripe.com/api for details, or email support@stripe.com if you have any questions.'); } $absUrl = $this->apiUrl($url); $params = Stripe_Util::arrayClone($params); $params = self::_encodeObjects($params); $langVersion = phpversion(); $uname = php_uname(); $ua = array('bindings_version' => Stripe::VERSION, 'lang' => 'php', 'lang_version' => $langVersion, 'publisher' => 'stripe', 'uname' => $uname); $headers = array('X-Stripe-Client-User-Agent: ' . json_encode($ua), 'User-Agent: Stripe/v1 PhpBindings/' . Stripe::VERSION); list($rbody, $rcode) = $this->_curlRequest($meth, $absUrl, $headers, $params, $myApiKey); return array($rbody, $rcode, $myApiKey); }
protected function _stringify($nested = false) { $ident = array_filter($this->_ident()); if ($ident) { $ident = '[' . join(', ', $ident) . ']'; } else { $ident = ''; } $class = get_class($this); if ($nested) { return "<{$class}{$ident} ...>"; } $valuesStr = array(); $values = Stripe_Util::arrayClone($this->_values); ksort($values); foreach ($values as $k => $v) { if (self::$_ignoredAttributes->includes($k)) { continue; } $v = $this->{$k}; if ($v instanceof Stripe_Object) { $v = $v->_stringify(true); } else { if (is_bool($v)) { $v = $v ? 'true' : 'false'; } else { $v = "{$v}"; } } if ($this->_unsavedValues->includes($k)) { array_push($valuesStr, "{$k}={$v} (unsaved)"); } else { array_push($valuesStr, "{$k}={$v}"); } } if (count($valuesStr) == 0) { array_push($valuesStr, '(no attributes)'); } $displayValues = join(', ', $valuesStr); return "<{$class}{$ident} {$displayValues}>"; }