summaryrefslogtreecommitdiffstats
path: root/vendor/stripe/stripe-php/lib/ApiOperations/NestedResource.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/stripe/stripe-php/lib/ApiOperations/NestedResource.php')
-rw-r--r--vendor/stripe/stripe-php/lib/ApiOperations/NestedResource.php270
1 files changed, 135 insertions, 135 deletions
diff --git a/vendor/stripe/stripe-php/lib/ApiOperations/NestedResource.php b/vendor/stripe/stripe-php/lib/ApiOperations/NestedResource.php
index 180cacd..ed9c830 100644
--- a/vendor/stripe/stripe-php/lib/ApiOperations/NestedResource.php
+++ b/vendor/stripe/stripe-php/lib/ApiOperations/NestedResource.php
@@ -1,135 +1,135 @@
-<?php
-
-namespace Stripe\ApiOperations;
-
-/**
- * Trait for resources that have nested resources.
- *
- * This trait should only be applied to classes that derive from StripeObject.
- */
-trait NestedResource
-{
- /**
- * @param string $method
- * @param string $url
- * @param null|array $params
- * @param null|array|string $options
- *
- * @return \Stripe\StripeObject
- */
- protected static function _nestedResourceOperation($method, $url, $params = null, $options = null)
- {
- self::_validateParams($params);
-
- list($response, $opts) = static::_staticRequest($method, $url, $params, $options);
- $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
- $obj->setLastResponse($response);
-
- return $obj;
- }
-
- /**
- * @param string $id
- * @param string $nestedPath
- * @param null|string $nestedId
- *
- * @return string
- */
- protected static function _nestedResourceUrl($id, $nestedPath, $nestedId = null)
- {
- $url = static::resourceUrl($id) . $nestedPath;
- if (null !== $nestedId) {
- $url .= "/{$nestedId}";
- }
-
- return $url;
- }
-
- /**
- * @param string $id
- * @param string $nestedPath
- * @param null|array $params
- * @param null|array|string $options
- *
- * @throws \Stripe\Exception\ApiErrorException if the request fails
- *
- * @return \Stripe\StripeObject
- */
- protected static function _createNestedResource($id, $nestedPath, $params = null, $options = null)
- {
- $url = static::_nestedResourceUrl($id, $nestedPath);
-
- return self::_nestedResourceOperation('post', $url, $params, $options);
- }
-
- /**
- * @param string $id
- * @param string $nestedPath
- * @param null|string $nestedId
- * @param null|array $params
- * @param null|array|string $options
- *
- * @throws \Stripe\Exception\ApiErrorException if the request fails
- *
- * @return \Stripe\StripeObject
- */
- protected static function _retrieveNestedResource($id, $nestedPath, $nestedId, $params = null, $options = null)
- {
- $url = static::_nestedResourceUrl($id, $nestedPath, $nestedId);
-
- return self::_nestedResourceOperation('get', $url, $params, $options);
- }
-
- /**
- * @param string $id
- * @param string $nestedPath
- * @param null|string $nestedId
- * @param null|array $params
- * @param null|array|string $options
- *
- * @throws \Stripe\Exception\ApiErrorException if the request fails
- *
- * @return \Stripe\StripeObject
- */
- protected static function _updateNestedResource($id, $nestedPath, $nestedId, $params = null, $options = null)
- {
- $url = static::_nestedResourceUrl($id, $nestedPath, $nestedId);
-
- return self::_nestedResourceOperation('post', $url, $params, $options);
- }
-
- /**
- * @param string $id
- * @param string $nestedPath
- * @param null|string $nestedId
- * @param null|array $params
- * @param null|array|string $options
- *
- * @throws \Stripe\Exception\ApiErrorException if the request fails
- *
- * @return \Stripe\StripeObject
- */
- protected static function _deleteNestedResource($id, $nestedPath, $nestedId, $params = null, $options = null)
- {
- $url = static::_nestedResourceUrl($id, $nestedPath, $nestedId);
-
- return self::_nestedResourceOperation('delete', $url, $params, $options);
- }
-
- /**
- * @param string $id
- * @param string $nestedPath
- * @param null|array $params
- * @param null|array|string $options
- *
- * @throws \Stripe\Exception\ApiErrorException if the request fails
- *
- * @return \Stripe\StripeObject
- */
- protected static function _allNestedResources($id, $nestedPath, $params = null, $options = null)
- {
- $url = static::_nestedResourceUrl($id, $nestedPath);
-
- return self::_nestedResourceOperation('get', $url, $params, $options);
- }
-}
+<?php
+
+namespace Stripe\ApiOperations;
+
+/**
+ * Trait for resources that have nested resources.
+ *
+ * This trait should only be applied to classes that derive from StripeObject.
+ */
+trait NestedResource
+{
+ /**
+ * @param string $method
+ * @param string $url
+ * @param null|array $params
+ * @param null|array|string $options
+ *
+ * @return \Stripe\StripeObject
+ */
+ protected static function _nestedResourceOperation($method, $url, $params = null, $options = null)
+ {
+ self::_validateParams($params);
+
+ list($response, $opts) = static::_staticRequest($method, $url, $params, $options);
+ $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
+ $obj->setLastResponse($response);
+
+ return $obj;
+ }
+
+ /**
+ * @param string $id
+ * @param string $nestedPath
+ * @param null|string $nestedId
+ *
+ * @return string
+ */
+ protected static function _nestedResourceUrl($id, $nestedPath, $nestedId = null)
+ {
+ $url = static::resourceUrl($id) . $nestedPath;
+ if (null !== $nestedId) {
+ $url .= "/{$nestedId}";
+ }
+
+ return $url;
+ }
+
+ /**
+ * @param string $id
+ * @param string $nestedPath
+ * @param null|array $params
+ * @param null|array|string $options
+ *
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \Stripe\StripeObject
+ */
+ protected static function _createNestedResource($id, $nestedPath, $params = null, $options = null)
+ {
+ $url = static::_nestedResourceUrl($id, $nestedPath);
+
+ return self::_nestedResourceOperation('post', $url, $params, $options);
+ }
+
+ /**
+ * @param string $id
+ * @param string $nestedPath
+ * @param null|string $nestedId
+ * @param null|array $params
+ * @param null|array|string $options
+ *
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \Stripe\StripeObject
+ */
+ protected static function _retrieveNestedResource($id, $nestedPath, $nestedId, $params = null, $options = null)
+ {
+ $url = static::_nestedResourceUrl($id, $nestedPath, $nestedId);
+
+ return self::_nestedResourceOperation('get', $url, $params, $options);
+ }
+
+ /**
+ * @param string $id
+ * @param string $nestedPath
+ * @param null|string $nestedId
+ * @param null|array $params
+ * @param null|array|string $options
+ *
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \Stripe\StripeObject
+ */
+ protected static function _updateNestedResource($id, $nestedPath, $nestedId, $params = null, $options = null)
+ {
+ $url = static::_nestedResourceUrl($id, $nestedPath, $nestedId);
+
+ return self::_nestedResourceOperation('post', $url, $params, $options);
+ }
+
+ /**
+ * @param string $id
+ * @param string $nestedPath
+ * @param null|string $nestedId
+ * @param null|array $params
+ * @param null|array|string $options
+ *
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \Stripe\StripeObject
+ */
+ protected static function _deleteNestedResource($id, $nestedPath, $nestedId, $params = null, $options = null)
+ {
+ $url = static::_nestedResourceUrl($id, $nestedPath, $nestedId);
+
+ return self::_nestedResourceOperation('delete', $url, $params, $options);
+ }
+
+ /**
+ * @param string $id
+ * @param string $nestedPath
+ * @param null|array $params
+ * @param null|array|string $options
+ *
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \Stripe\StripeObject
+ */
+ protected static function _allNestedResources($id, $nestedPath, $params = null, $options = null)
+ {
+ $url = static::_nestedResourceUrl($id, $nestedPath);
+
+ return self::_nestedResourceOperation('get', $url, $params, $options);
+ }
+}