Skip to content

Commit 18b70f8

Browse files
author
mostafa
committed
phpdoc
1 parent ada50e3 commit 18b70f8

File tree

1 file changed

+74
-4
lines changed

1 file changed

+74
-4
lines changed

src/StripeSubscription.php

Lines changed: 74 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,51 @@
1919
class StripeSubscription
2020
{
2121
/**
22-
* Secret key
22+
* Secret key.
2323
* @var string
2424
*/
2525
private $secretKey;
2626
/**
27-
* Customer all data after create
27+
* Customer all data after create.
2828
* @var object
2929
*/
3030
private $customer;
3131

32+
/**
33+
* All data which properties of create the subscription.
34+
* @var array
35+
*/
3236
private $createSubscriptionData = [];
3337

38+
/**
39+
* Plan which will be subcription.
40+
* @var string
41+
*/
3442
private $plan;
3543

44+
/**
45+
* Add others properties of create the subscription.
46+
* @var array
47+
*/
3648
private $extra = [];
37-
// trail day from plan
49+
50+
/**
51+
* Trial default from plan.
52+
* @var boolean
53+
*/
3854
private $trialPlan = false;
3955

56+
/**
57+
* How many trial day for subscription.
58+
* This will be override the plan trial day.
59+
* @var integer
60+
*/
4061
private $trial;
62+
63+
/**
64+
* Subcription with coupon.
65+
* @var string
66+
*/
4167
private $coupon;
4268

4369
public function __construct()
@@ -47,7 +73,7 @@ public function __construct()
4773
}
4874
}
4975
/**
50-
* Set secret key
76+
* Set secret key.
5177
* @param string $data
5278
* @return $this
5379
*/
@@ -59,18 +85,33 @@ public function setup($data)
5985
return $this;
6086
}
6187

88+
/**
89+
* set customer id which create by customer alias.
90+
* @param string $id customer id
91+
* @return $this
92+
*/
6293
public function customer($id)
6394
{
6495
$this->customer = $id;
6596
return $this;
6697
}
6798

99+
/**
100+
* Plan id which generate by LaraStripePlan alias.
101+
* @param string $id plan id
102+
* @return $this
103+
*/
68104
public function plan($id)
69105
{
70106
$this->plan = $id;
71107
return $this;
72108
}
73109

110+
/**
111+
* stripe subscription others properties which not declare this package.
112+
* @param array $data
113+
* @return $this
114+
*/
74115
public function extra($data = [])
75116
{
76117
if (is_array($data)) {
@@ -79,22 +120,41 @@ public function extra($data = [])
79120
return $this;
80121
}
81122

123+
/**
124+
* Default trial time from plan.
125+
* @return $this
126+
*/
82127
public function trialPlan()
83128
{
84129
$this->trialPlan = true;
85130
return $this;
86131
}
87132

133+
/**
134+
* Set subscription trial.
135+
* override the plan trial day.
136+
* @param integer $day
137+
* @return $this
138+
*/
88139
public function trial($day) {
89140
$this->trial = $day;
90141
return $this;
91142
}
92143

144+
/**
145+
* Coupon apply
146+
* @param string $code
147+
* @return $this
148+
*/
93149
public function coupon($code) {
94150
$this->coupon = $code;
95151
return $this;
96152
}
97153

154+
/**
155+
* Create & retreive all data.
156+
* @return object
157+
*/
98158
public function get()
99159
{
100160
$this->createSubscriptionData['customer'] = $this->customer;
@@ -119,6 +179,11 @@ public function get()
119179
}
120180
}
121181

182+
/**
183+
* Retrieve a subscription with id
184+
* @param string $id
185+
* @return object
186+
*/
122187
public function retrieve($id)
123188
{
124189
try {
@@ -130,6 +195,11 @@ public function retrieve($id)
130195
}
131196
}
132197

198+
/**
199+
* Cancel a subscription.
200+
* @param string $id
201+
* @return object
202+
*/
133203
public function cancel($id)
134204
{
135205
try {

0 commit comments

Comments
 (0)