• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stripe / stripe-php / 9308533534

30 May 2024 08:07PM UTC coverage: 65.24% (-0.9%) from 66.176%
9308533534

push

github

web-flow
Added PHPDocs for `create`, `update`, `delete`, `all`, `retrieve` methods after moving them out of traits.  (#1701)

* Demagiced crudl operation

* Improvements from codegen#1452

* Updated override to fix indents

1080 of 1682 new or added lines in 106 files covered. (64.21%)

15 existing lines in 3 files now uncovered.

3444 of 5279 relevant lines covered (65.24%)

2.29 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

50.0
/lib/ApiOperations/Update.php
1
<?php
2

3
namespace Stripe\ApiOperations;
4

5
/**
6
 * Trait for updatable resources. Adds an `update()` static method and a
7
 * `save()` method to the class.
8
 *
9
 * This trait should only be applied to classes that derive from StripeObject.
10
 */
11
trait Update
12
{
13
    /**
14
     * @param string $id the ID of the resource to update
15
     * @param null|array $params
16
     * @param null|array|string $opts
17
     *
18
     * @throws \Stripe\Exception\ApiErrorException if the request fails
19
     *
20
     * @return static the updated resource
21
     */
UNCOV
22
    public static function update($id, $params = null, $opts = null)
×
23
    {
UNCOV
24
        self::_validateParams($params);
×
UNCOV
25
        $url = static::resourceUrl($id);
×
26

UNCOV
27
        list($response, $opts) = static::_staticRequest('post', $url, $params, $opts);
×
UNCOV
28
        $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
×
UNCOV
29
        $obj->setLastResponse($response);
×
30

UNCOV
31
        return $obj;
×
32
    }
33

34
    /**
35
     * @param null|array|string $opts
36
     *
37
     * @throws \Stripe\Exception\ApiErrorException if the request fails
38
     *
39
     * @return static the saved resource
40
     *
41
     * @deprecated The `save` method is deprecated and will be removed in a
42
     *     future major version of the library. Use the static method `update`
43
     *     on the resource instead.
44
     */
45
    public function save($opts = null)
37✔
46
    {
47
        $params = $this->serializeParameters();
37✔
48
        if (\count($params) > 0) {
37✔
49
            $url = $this->instanceUrl();
37✔
50
            list($response, $opts) = $this->_request('post', $url, $params, $opts, ['save']);
37✔
51
            $this->refreshFrom($response, $opts);
37✔
52
        }
53

54
        return $this;
37✔
55
    }
56
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc