diff --git a/lib/Service/AbstractService.php b/lib/Service/AbstractService.php index 3c43735857..00f7d5801d 100644 --- a/lib/Service/AbstractService.php +++ b/lib/Service/AbstractService.php @@ -22,14 +22,6 @@ public function __construct($client) $this->client = $client; } - /** - * Returns the base path for requests issued by this service. Must be - * implemented by all concrete subclasses. - * - * @return string the base path for requests issued by this service - */ - abstract public function basePath(); - /** * Gets the client used by this service to send requests. * @@ -40,85 +32,21 @@ public function getClient() return $this->client; } - protected function allObjects($params, $opts) - { - return $this->request('get', $this->basePath(), $params, $opts); - } - - protected function allNestedObjects($nestedPath, $parentId, $params, $opts) - { - return $this->request('get', $this->baseNestedPath($parentId, $nestedPath), $params, $opts); - } - - protected function createObject($params, $opts) - { - return $this->request('post', $this->basePath(), $params, $opts); - } - - protected function createNestedObject($nestedPath, $parentId, $params, $opts) - { - return $this->request('post', $this->baseNestedPath($parentId, $nestedPath), $params, $opts); - } - - protected function deleteObject($id, $params, $opts) - { - return $this->request('delete', $this->instancePath($id), $params, $opts); - } - - protected function deleteNestedObject($nestedPath, $parentId, $id, $params, $opts) - { - return $this->request('delete', $this->instanceNestedPath($parentId, $nestedPath, $id), $params, $opts); - } - - protected function retrieveObject($id, $params, $opts) - { - return $this->request('get', $this->instancePath($id), $params, $opts); - } - - protected function retrieveNestedObject($nestedPath, $parentId, $id, $params, $opts) - { - return $this->request('get', $this->instanceNestedPath($parentId, $nestedPath, $id), $params, $opts); - } - - protected function updateObject($id, $params, $opts) - { - return $this->request('post', $this->instancePath($id), $params, $opts); - } - - protected function updateNestedObject($nestedPath, $parentId, $id, $params, $opts) - { - return $this->request('post', $this->instanceNestedPath($parentId, $nestedPath, $id), $params, $opts); - } - protected function request($method, $path, $params, $opts) { return $this->getClient()->request($method, $path, $params, $opts); } - protected function baseNestedPath($parentId, $nestedPath) - { - return $this->instancePath($parentId) . '/' . $nestedPath; - } - - protected function instancePath($id) - { - if (null === $id || '' === \trim($id)) { - $msg = 'The resource ID cannot be null or whitespace.'; - - throw new \Stripe\Exception\InvalidArgumentException($msg); - } - - return $this->basePath() . '/' . \urlencode($id); - } - - protected function instanceNestedPath($parentId, $nestedPath, $id) + protected function buildPath($basePath, ...$ids) { - if (null === $id || '' === \trim($id)) { - $msg = 'The resource ID cannot be null or whitespace.'; + foreach ($ids as $id) { + if (null === $id || '' === \trim($id)) { + $msg = 'The resource ID cannot be null or whitespace.'; - throw new \Stripe\Exception\InvalidArgumentException($msg); + throw new \Stripe\Exception\InvalidArgumentException($msg); + } } - return $this->baseNestedPath($parentId, $nestedPath) . '/' . \urlencode($id); + return \sprintf($basePath, ...\array_map('\urlencode', $ids)); } } diff --git a/lib/Service/CouponService.php b/lib/Service/CouponService.php index 8c1fec02e9..c0b05ec81a 100644 --- a/lib/Service/CouponService.php +++ b/lib/Service/CouponService.php @@ -4,76 +4,71 @@ class CouponService extends AbstractService { - public function basePath() - { - return '/v1/coupons'; - } - /** * List all coupons. * - * @param array $params - * @param array $opts + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\Collection */ - public function all($params = [], $opts = []) + public function all($params = null, $opts = null) { - return $this->allObjects($params, $opts); + return $this->request('get', '/v1/coupons', $params, $opts); } /** * Create a coupon. * - * @param array $params - * @param array $opts + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\Coupon */ - public function create($params = [], $opts = []) + public function create($params = null, $opts = null) { - return $this->createObject($params, $opts); + return $this->request('post', '/v1/coupons', $params, $opts); } /** * Delete a coupon. * * @param string $id - * @param array $params - * @param array $opts + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\Coupon */ - public function delete($id, $params = [], $opts = []) + public function delete($id, $params = null, $opts = null) { - return $this->deleteObject($id, $params, $opts); + return $this->request('delete', $this->buildPath('/v1/coupons/%s', $id), $params, $opts); } /** * Retrieve a coupon. * * @param string $id - * @param array $params - * @param array $opts + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\Coupon */ - public function retrieve($id, $params = [], $opts = []) + public function retrieve($id, $params = null, $opts = null) { - return $this->retrieveObject($id, $params, $opts); + return $this->request('get', $this->buildPath('/v1/coupons/%s', $id), $params, $opts); } /** * Update a coupon. * * @param string $id - * @param array $params - * @param array $opts + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\Coupon */ - public function update($id, $params = [], $opts = []) + public function update($id, $params = null, $opts = null) { - return $this->updateObject($id, $params, $opts); + return $this->request('post', $this->buildPath('/v1/coupons/%s', $id), $params, $opts); } } diff --git a/lib/Service/CustomerService.php b/lib/Service/CustomerService.php index 0a9707afa8..59a782fb3b 100644 --- a/lib/Service/CustomerService.php +++ b/lib/Service/CustomerService.php @@ -4,303 +4,289 @@ class CustomerService extends AbstractService { - const BALANCE_TRANSACTIONS = 'balance_transactions'; - const SOURCES = 'sources'; - const TAX_IDS = 'tax_ids'; - - public function basePath() - { - return '/v1/customers'; - } - /** * List all customers. * - * @param array $params - * @param array $opts + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\Collection */ - public function all($params = [], $opts = []) + public function all($params = null, $opts = null) { - return $this->allObjects($params, $opts); + return $this->request('get', '/v1/customers', $params, $opts); } /** * List customer balance transactions. * - * @param string $customerId - * @param array $params - * @param array $opts + * @param string $parentId + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\Collection */ - public function allBalanceTransactions($customerId, $params = [], $opts = []) + public function allBalanceTransactions($parentId, $params = null, $opts = null) { - return $this->allNestedObjects(self::BALANCE_TRANSACTIONS, $customerId, $params, $opts); + return $this->request('get', $this->buildPath('/v1/customers/%s/balance_transactions', $parentId), $params, $opts); } /** * List all sources. * - * @param string $customerId - * @param array $params - * @param array $opts + * @param string $parentId + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\Collection */ - public function allSources($customerId, $params = [], $opts = []) + public function allSources($parentId, $params = null, $opts = null) { - return $this->allNestedObjects(self::SOURCES, $customerId, $params, $opts); + return $this->request('get', $this->buildPath('/v1/customers/%s/sources', $parentId), $params, $opts); } /** * List all tax IDs. * - * @param string $customerId - * @param array $params - * @param array $opts + * @param string $parentId + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\Collection */ - public function allTaxIds($customerId, $params = [], $opts = []) + public function allTaxIds($parentId, $params = null, $opts = null) { - return $this->allNestedObjects(self::TAX_IDS, $customerId, $params, $opts); + return $this->request('get', $this->buildPath('/v1/customers/%s/tax_ids', $parentId), $params, $opts); } /** * Create a customer. * - * @param array $params - * @param array $opts + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\Customer */ - public function create($params = [], $opts = []) + public function create($params = null, $opts = null) { - return $this->createObject($params, $opts); + return $this->request('post', '/v1/customers', $params, $opts); } /** * Create a balance transaction. * - * @param string $customerId - * @param array $params - * @param array $opts + * @param string $parentId + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\CustomerBalanceTransaction */ - public function createBalanceTransaction($customerId, $params = [], $opts = []) + public function createBalanceTransaction($parentId, $params = null, $opts = null) { - return $this->createNestedObject(self::BALANCE_TRANSACTIONS, $customerId, $params, $opts); + return $this->request('post', $this->buildPath('/v1/customers/%s/balance_transactions', $parentId), $params, $opts); } /** * Create a source. * - * @param string $customerId - * @param array $params - * @param array $opts + * @param string $parentId + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\BankAccount|\Stripe\Card|\Stripe\Source */ - public function createSource($customerId, $params = [], $opts = []) + public function createSource($parentId, $params = null, $opts = null) { - return $this->createNestedObject(self::SOURCES, $customerId, $params, $opts); + return $this->request('post', $this->buildPath('/v1/customers/%s/sources', $parentId), $params, $opts); } /** * Create a tax ID. * - * @param string $customerId - * @param array $params - * @param array $opts + * @param string $parentId + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\TaxId */ - public function createTaxId($customerId, $params = [], $opts = []) + public function createTaxId($parentId, $params = null, $opts = null) { - return $this->createNestedObject(self::TAX_IDS, $customerId, $params, $opts); + return $this->request('post', $this->buildPath('/v1/customers/%s/tax_ids', $parentId), $params, $opts); } /** * Delete a customer. * * @param string $id - * @param array $params - * @param array $opts + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\Customer */ - public function delete($id, $params = [], $opts = []) + public function delete($id, $params = null, $opts = null) { - return $this->deleteObject($id, $params, $opts); + return $this->request('delete', $this->buildPath('/v1/customers/%s', $id), $params, $opts); } /** * Delete a customer discount. * * @param string $id - * @param array $params - * @param array $opts + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\Discount */ - public function deleteDiscount($id, $params = [], $opts = []) + public function deleteDiscount($id, $params = null, $opts = null) { - return $this->request('delete', $this->instancePath($id) . '/discount', $params, $opts); + return $this->request('delete', $this->buildPath('/v1/customers/%s/discount', $id), $params, $opts); } /** * Delete a source. * - * @param string $customerId + * @param string $parentId * @param string $id - * @param array $params - * @param array $opts + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\BankAccount|\Stripe\Card|\Stripe\Source */ - public function deleteSource($customerId, $id, $params = [], $opts = []) + public function deleteSource($parentId, $id, $params = null, $opts = null) { - return $this->deleteNestedObject(self::SOURCES, $customerId, $id, $params, $opts); + return $this->request('delete', $this->buildPath('/v1/customers/%s/sources/%s', $parentId, $id), $params, $opts); } /** * Delete a tax ID. * - * @param string $customerId + * @param string $parentId * @param string $id - * @param array $params - * @param array $opts + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\TaxId */ - public function deleteTaxId($customerId, $id, $params = [], $opts = []) + public function deleteTaxId($parentId, $id, $params = null, $opts = null) { - return $this->deleteNestedObject(self::TAX_IDS, $customerId, $id, $params, $opts); + return $this->request('delete', $this->buildPath('/v1/customers/%s/tax_ids/%s', $parentId, $id), $params, $opts); } /** * Retrieve a customer. * * @param string $id - * @param array $params - * @param array $opts + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\Customer */ - public function retrieve($id, $params = [], $opts = []) + public function retrieve($id, $params = null, $opts = null) { - return $this->retrieveObject($id, $params, $opts); + return $this->request('get', $this->buildPath('/v1/customers/%s', $id), $params, $opts); } /** * Retrieve a balance transaction. * - * @param string $customerId + * @param string $parentId * @param string $id - * @param array $params - * @param array $opts + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\CustomerBalanceTransaction */ - public function retrieveBalanceTransaction($customerId, $id, $params = [], $opts = []) + public function retrieveBalanceTransaction($parentId, $id, $params = null, $opts = null) { - return $this->retrieveNestedObject(self::BALANCE_TRANSACTIONS, $customerId, $id, $params, $opts); + return $this->request('get', $this->buildPath('/v1/customers/%s/balance_transactions/%s', $parentId, $id), $params, $opts); } /** * Retrieve a source. * - * @param string $customerId + * @param string $parentId * @param string $id - * @param array $params - * @param array $opts + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\BankAccount|\Stripe\Card|\Stripe\Source */ - public function retrieveSource($customerId, $id, $params = [], $opts = []) + public function retrieveSource($parentId, $id, $params = null, $opts = null) { - return $this->retrieveNestedObject(self::SOURCES, $customerId, $id, $params, $opts); + return $this->request('get', $this->buildPath('/v1/customers/%s/sources/%s', $parentId, $id), $params, $opts); } /** * Retrieve a tax ID. * - * @param string $customerId + * @param string $parentId * @param string $id - * @param array $params - * @param array $opts + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\TaxId */ - public function retrieveTaxId($customerId, $id, $params = [], $opts = []) + public function retrieveTaxId($parentId, $id, $params = null, $opts = null) { - return $this->retrieveNestedObject(self::TAX_IDS, $customerId, $id, $params, $opts); + return $this->request('get', $this->buildPath('/v1/customers/%s/tax_ids/%s', $parentId, $id), $params, $opts); } /** * Update a customer. * * @param string $id - * @param array $params - * @param array $opts + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\Customer */ - public function update($id, $params = [], $opts = []) + public function update($id, $params = null, $opts = null) { - return $this->updateObject($id, $params, $opts); + return $this->request('post', $this->buildPath('/v1/customers/%s', $id), $params, $opts); } /** * Update a balance transaction. * - * @param string $customerId + * @param string $parentId * @param string $id - * @param array $params - * @param array $opts + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\CustomerBalanceTransaction */ - public function updateBalanceTransaction($customerId, $id, $params = [], $opts = []) + public function updateBalanceTransaction($parentId, $id, $params = null, $opts = null) { - return $this->updateNestedObject(self::BALANCE_TRANSACTIONS, $customerId, $id, $params, $opts); + return $this->request('post', $this->buildPath('/v1/customers/%s/balance_transactions/%s', $parentId, $id), $params, $opts); } /** * Update a source. * - * @param string $customerId + * @param string $parentId * @param string $id - * @param array $params - * @param array $opts + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\BankAccount|\Stripe\Card|\Stripe\Source */ - public function updateSource($customerId, $id, $params = [], $opts = []) + public function updateSource($parentId, $id, $params = null, $opts = null) { - return $this->updateNestedObject(self::SOURCES, $customerId, $id, $params, $opts); + return $this->request('post', $this->buildPath('/v1/customers/%s/sources/%s', $parentId, $id), $params, $opts); } /** * Verify a source. * - * @param string $customerId + * @param string $parentId * @param string $id - * @param array $params - * @param array $opts + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\BankAccount */ - public function verifySource($customerId, $id, $params = [], $opts = []) + public function verifySource($parentId, $id, $params = null, $opts = null) { - return $this->request( - 'post', - $this->instanceNestedPath($customerId, self::SOURCES, $id) . '/verify', - $params, - $opts - ); + return $this->request('post', $this->buildPath('/v1/customers/%s/sources/%s/verify', $parentId, $id), $params, $opts); } } diff --git a/lib/Service/FileService.php b/lib/Service/FileService.php index 6741a07428..4d83ab6050 100644 --- a/lib/Service/FileService.php +++ b/lib/Service/FileService.php @@ -4,33 +4,28 @@ class FileService extends AbstractService { - public function basePath() - { - return '/v1/files'; - } - /** * List all files. * - * @param array $params - * @param array $opts + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\Collection */ - public function all($params = [], $opts = []) + public function all($params = null, $opts = null) { - return $this->allObjects($params, $opts); + return $this->request('get', '/v1/files', $params, $opts); } /** * Create a file. * - * @param array $params - * @param array $opts + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\File */ - public function create($params = [], $opts = []) + public function create($params = null, $opts = null) { $opts = \Stripe\Util\RequestOptions::parse($opts); if (!isset($opts->apiBase)) { @@ -38,23 +33,23 @@ public function create($params = [], $opts = []) } // Manually flatten params, otherwise curl's multipart encoder will - // choke on nested arrays. + // choke on nested null|arrays. $flatParams = \array_column(\Stripe\Util\Util::flattenParams($params), 1, 0); - return $this->createObject($flatParams, $opts); + return $this->request('post', '/v1/files', $flatParams, $opts); } /** * Retrieve a file. * * @param string $id - * @param array $params - * @param array $opts + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\File */ - public function retrieve($id, $params = [], $opts = []) + public function retrieve($id, $params = null, $opts = null) { - return $this->retrieveObject($id, $params, $opts); + return $this->request('get', $this->buildPath('/v1/files/%s', $id), $params, $opts); } } diff --git a/lib/Service/Issuing/CardService.php b/lib/Service/Issuing/CardService.php index d95ae2ce65..37825e4822 100644 --- a/lib/Service/Issuing/CardService.php +++ b/lib/Service/Issuing/CardService.php @@ -12,68 +12,68 @@ public function basePath() /** * List all cards. * - * @param array $params - * @param array $opts + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\Collection */ - public function all($params = [], $opts = []) + public function all($params = null, $opts = null) { - return $this->allObjects($params, $opts); + return $this->request('get', '/v1/issuing/cards', $params, $opts); } /** * Create a card. * - * @param array $params - * @param array $opts + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\Issuing\Card */ - public function create($params = [], $opts = []) + public function create($params = null, $opts = null) { - return $this->createObject($params, $opts); + return $this->request('post', '/v1/issuing/cards', $params, $opts); } /** * Retrieve a card details. * * @param string $id - * @param array $params - * @param array $opts + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\Issuing\CardDetails */ - public function details($id, $params = [], $opts = []) + public function details($id, $params = null, $opts = null) { - return $this->request('get', $this->instancePath($id) . '/details', $params, $opts); + return $this->request('get', $this->buildPath('/v1/issuing/cards/%s/details', $id), $params, $opts); } /** * Retrieve a card. * * @param string $id - * @param array $params - * @param array $opts + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\Issuing\Card */ - public function retrieve($id, $params = [], $opts = []) + public function retrieve($id, $params = null, $opts = null) { - return $this->retrieveObject($id, $params, $opts); + return $this->request('get', $this->buildPath('/v1/issuing/cards/%s', $id), $params, $opts); } /** * Update a card. * * @param string $id - * @param array $params - * @param array $opts + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\Issuing\Card */ - public function update($id, $params = [], $opts = []) + public function update($id, $params = null, $opts = null) { - return $this->updateObject($id, $params, $opts); + return $this->request('post', $this->buildPath('/v1/issuing/cards/%s', $id), $params, $opts); } } diff --git a/lib/Service/PaymentIntentService.php b/lib/Service/PaymentIntentService.php index bd78b5fcd4..a7f4eddaaa 100644 --- a/lib/Service/PaymentIntentService.php +++ b/lib/Service/PaymentIntentService.php @@ -4,90 +4,85 @@ class PaymentIntentService extends AbstractService { - public function basePath() - { - return '/v1/payment_intents'; - } - /** * List all payment intents. * - * @param array $params - * @param array $opts + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\Collection */ - public function all($params = [], $opts = []) + public function all($params = null, $opts = null) { - return $this->allObjects($params, $opts); + return $this->request('get', '/v1/payment_intents', $params, $opts); } /** * Capture a payment intent. * * @param string $id - * @param array $params - * @param array $opts + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\PaymentIntent */ - public function capture($id, $params = [], $opts = []) + public function capture($id, $params = null, $opts = null) { - return $this->request('post', $this->instancePath($id) . '/capture', $params, $opts); + return $this->request('post', $this->buildPath('/v1/payment_intents/%s/capture', $id), $params, $opts); } /** * Confirm a payment intent. * * @param string $id - * @param array $params - * @param array $opts + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\PaymentIntent */ - public function confirm($id, $params = [], $opts = []) + public function confirm($id, $params = null, $opts = null) { - return $this->request('post', $this->instancePath($id) . '/confirm', $params, $opts); + return $this->request('post', $this->buildPath('/v1/payment_intents/%s/confirm', $id), $params, $opts); } /** * Create a payment intent. * - * @param array $params - * @param array $opts + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\PaymentIntent */ - public function create($params = [], $opts = []) + public function create($params = null, $opts = null) { - return $this->createObject($params, $opts); + return $this->request('post', '/v1/payment_intents', $params, $opts); } /** * Retrieve a payment intent. * * @param string $id - * @param array $params - * @param array $opts + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\PaymentIntent */ - public function retrieve($id, $params = [], $opts = []) + public function retrieve($id, $params = null, $opts = null) { - return $this->retrieveObject($id, $params, $opts); + return $this->request('get', $this->buildPath('/v1/payment_intents/%s', $id), $params, $opts); } /** * Update a payment intent. * * @param string $id - * @param array $params - * @param array $opts + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts * * @return \Stripe\PaymentIntent */ - public function update($id, $params = [], $opts = []) + public function update($id, $params = null, $opts = null) { - return $this->updateObject($id, $params, $opts); + return $this->request('post', $this->buildPath('/v1/payment_intents/%s', $id), $params, $opts); } } diff --git a/tests/Stripe/Service/AbstractServiceTest.php b/tests/Stripe/Service/AbstractServiceTest.php index aa7d7cd718..b084e23a60 100644 --- a/tests/Stripe/Service/AbstractServiceTest.php +++ b/tests/Stripe/Service/AbstractServiceTest.php @@ -9,7 +9,10 @@ final class AbstractServiceTest extends \PHPUnit\Framework\TestCase { const TEST_RESOURCE_ID = '25OFF'; + /** @var \Stripe\StripeClient */ private $client; + + /** @var CouponService */ private $service; /** diff --git a/tests/Stripe/Service/CouponServiceTest.php b/tests/Stripe/Service/CouponServiceTest.php index ccdeb62ddb..a5f2989952 100644 --- a/tests/Stripe/Service/CouponServiceTest.php +++ b/tests/Stripe/Service/CouponServiceTest.php @@ -11,7 +11,10 @@ final class CouponServiceTest extends \PHPUnit\Framework\TestCase const TEST_RESOURCE_ID = 'COUPON_ID'; + /** @var \Stripe\StripeClient */ private $client; + + /** @var CouponService */ private $service; /** diff --git a/tests/Stripe/Service/CustomerServiceTest.php b/tests/Stripe/Service/CustomerServiceTest.php index 79b2e68361..d1e3d04c57 100644 --- a/tests/Stripe/Service/CustomerServiceTest.php +++ b/tests/Stripe/Service/CustomerServiceTest.php @@ -14,7 +14,10 @@ final class CustomerServiceTest extends \PHPUnit\Framework\TestCase const TEST_SOURCE_ID = 'card_123'; const TEST_TAX_ID_ID = 'txi_123'; + /** @var \Stripe\StripeClient */ private $client; + + /** @var CustomerService */ private $service; /** diff --git a/tests/Stripe/Service/FileServiceTest.php b/tests/Stripe/Service/FileServiceTest.php index c55a0cc465..c75f594a73 100644 --- a/tests/Stripe/Service/FileServiceTest.php +++ b/tests/Stripe/Service/FileServiceTest.php @@ -11,7 +11,10 @@ final class FileServiceTest extends \PHPUnit\Framework\TestCase const TEST_RESOURCE_ID = 'file_123'; + /** @var \Stripe\StripeClient */ private $client; + + /** @var FileService */ private $service; /** diff --git a/tests/Stripe/Service/Issuing/CardServiceTest.php b/tests/Stripe/Service/Issuing/CardServiceTest.php index cec5cccf0a..453535e674 100644 --- a/tests/Stripe/Service/Issuing/CardServiceTest.php +++ b/tests/Stripe/Service/Issuing/CardServiceTest.php @@ -11,7 +11,10 @@ final class CardServiceTest extends \PHPUnit\Framework\TestCase const TEST_RESOURCE_ID = 'ic_123'; + /** @var \Stripe\StripeClient */ private $client; + + /** @var CardService */ private $service; /** diff --git a/tests/Stripe/Service/PaymentIntentServiceTest.php b/tests/Stripe/Service/PaymentIntentServiceTest.php index e0c7b66f7d..baebb99755 100644 --- a/tests/Stripe/Service/PaymentIntentServiceTest.php +++ b/tests/Stripe/Service/PaymentIntentServiceTest.php @@ -11,7 +11,10 @@ final class PaymentIntentServiceTest extends \PHPUnit\Framework\TestCase const TEST_RESOURCE_ID = 'pi_123'; + /** @var \Stripe\StripeClient */ private $client; + + /** @var PaymentIntentService */ private $service; /**