• 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

0.0
/lib/Entitlements/Feature.php
1
<?php
2

3
// File generated from our OpenAPI spec
4

5
namespace Stripe\Entitlements;
6

7
/**
8
 * A feature represents a monetizable ability or functionality in your system.
9
 * Features can be assigned to products, and when those products are purchased, Stripe will create an entitlement to the feature for the purchasing customer.
10
 *
11
 * @property string $id Unique identifier for the object.
12
 * @property string $object String representing the object's type. Objects of the same type share the same value.
13
 * @property bool $active Inactive features cannot be attached to new products and will not be returned from the features list endpoint.
14
 * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
15
 * @property string $lookup_key A unique key you provide as your own system identifier. This may be up to 80 characters.
16
 * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
17
 * @property string $name The feature's name, for your own purpose, not meant to be displayable to the customer.
18
 */
19
class Feature extends \Stripe\ApiResource
20
{
21
    const OBJECT_NAME = 'entitlements.feature';
22

23
    use \Stripe\ApiOperations\Update;
24

25
    /**
26
     * Creates a feature.
27
     *
28
     * @param null|array $params
29
     * @param null|array|string $options
30
     *
31
     * @throws \Stripe\Exception\ApiErrorException if the request fails
32
     *
33
     * @return \Stripe\Entitlements\Feature the created resource
34
     */
NEW
35
    public static function create($params = null, $options = null)
×
36
    {
NEW
37
        self::_validateParams($params);
×
NEW
38
        $url = static::classUrl();
×
39

NEW
40
        list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
×
NEW
41
        $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
×
NEW
42
        $obj->setLastResponse($response);
×
43

NEW
44
        return $obj;
×
45
    }
46

47
    /**
48
     * Retrieve a list of features.
49
     *
50
     * @param null|array $params
51
     * @param null|array|string $opts
52
     *
53
     * @throws \Stripe\Exception\ApiErrorException if the request fails
54
     *
55
     * @return \Stripe\Collection<\Stripe\Entitlements\Feature> of ApiResources
56
     */
NEW
57
    public static function all($params = null, $opts = null)
×
58
    {
NEW
59
        $url = static::classUrl();
×
60

NEW
61
        return static::_requestPage($url, \Stripe\Collection::class, $params, $opts);
×
62
    }
63

64
    /**
65
     * Retrieves a feature.
66
     *
67
     * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
68
     * @param null|array|string $opts
69
     *
70
     * @throws \Stripe\Exception\ApiErrorException if the request fails
71
     *
72
     * @return \Stripe\Entitlements\Feature
73
     */
NEW
74
    public static function retrieve($id, $opts = null)
×
75
    {
NEW
76
        $opts = \Stripe\Util\RequestOptions::parse($opts);
×
NEW
77
        $instance = new static($id, $opts);
×
NEW
78
        $instance->refresh();
×
79

NEW
80
        return $instance;
×
81
    }
82

83
    /**
84
     * Update a feature’s metadata or permanently deactivate it.
85
     *
86
     * @param string $id the ID of the resource to update
87
     * @param null|array $params
88
     * @param null|array|string $opts
89
     *
90
     * @throws \Stripe\Exception\ApiErrorException if the request fails
91
     *
92
     * @return \Stripe\Entitlements\Feature the updated resource
93
     */
NEW
94
    public static function update($id, $params = null, $opts = null)
×
95
    {
NEW
96
        self::_validateParams($params);
×
NEW
97
        $url = static::resourceUrl($id);
×
98

NEW
99
        list($response, $opts) = static::_staticRequest('post', $url, $params, $opts);
×
NEW
100
        $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
×
NEW
101
        $obj->setLastResponse($response);
×
102

NEW
103
        return $obj;
×
104
    }
105
}
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

© 2024 Coveralls, Inc