Skip to content

Commit 8535973

Browse files
committed
Code refactor use proper commenting.
1 parent e0d1302 commit 8535973

File tree

4 files changed

+63
-53
lines changed

4 files changed

+63
-53
lines changed

packages/Webkul/Workflow/src/Helpers/Entity/Activity.php

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
class Activity extends AbstractEntity
1717
{
1818
/**
19-
* @var string $code
19+
* Define the entity type.
20+
*
21+
* @var string $entityType
2022
*/
2123
protected $entityType = 'activities';
2224

@@ -39,6 +41,7 @@ public function __construct(
3941
*
4042
* @param string $entityType
4143
* @param array $skipAttributes
44+
*
4245
* @return array
4346
*/
4447
public function getAttributes($entityType, $skipAttributes = [])
@@ -110,7 +113,7 @@ public function getAttributes($entityType, $skipAttributes = [])
110113
}
111114

112115
/**
113-
* Returns placeholders for email templates
116+
* Returns placeholders for email templates.
114117
*
115118
* @param array $entity
116119
* @return array
@@ -128,7 +131,7 @@ public function getEmailTemplatePlaceholders($entity)
128131
}
129132

130133
/**
131-
* Replace placeholders with values
134+
* Replace placeholders with values.
132135
*
133136
* @param mixed $entity
134137
* @param array $values
@@ -155,9 +158,9 @@ public function replacePlaceholders($entity, $content)
155158
}
156159

157160
/**
158-
* Returns entity
161+
* Listing of the entities.
159162
*
160-
* @param \Webkul\Activity\Contracts\Activity|integer $entity
163+
* @param \Webkul\Activity\Contracts\Activity $entity
161164
* @return \Webkul\Activity\Contracts\Activity
162165
*/
163166
public function getEntity($entity)
@@ -170,7 +173,7 @@ public function getEntity($entity)
170173
}
171174

172175
/**
173-
* Returns workflow actions
176+
* Returns workflow actions.
174177
*
175178
* @return array
176179
*/
@@ -210,7 +213,7 @@ public function getActions()
210213
}
211214

212215
/**
213-
* Execute workflow actions
216+
* Execute workflow actions.
214217
*
215218
* @param \Webkul\Workflow\Contracts\Workflow $workflow
216219
* @param \Webkul\Activity\Contracts\Activity $activity
@@ -307,10 +310,10 @@ public function executeActions($workflow, $activity)
307310
}
308311

309312
/**
310-
* trigger webhook
313+
* Trigger Webhook.
311314
*
312-
* @param $hook
313-
* @param $activity
315+
* @param array $hook
316+
* @param \Webkul\Activity\Contracts\Activity $activity
314317
* @return void
315318
*/
316319
private function triggerWebhook($hook, $activity)
@@ -332,9 +335,9 @@ private function triggerWebhook($hook, $activity)
332335
}
333336

334337
/**
335-
* format headers
338+
* Formatting headers.
336339
*
337-
* @param $hook
340+
* @param array $hook
338341
* @return array
339342
*/
340343
private function formatHeaders($hook)
@@ -353,10 +356,11 @@ private function formatHeaders($hook)
353356
}
354357

355358
/**
356-
* prepare request body
359+
* Prepare Request Body.
360+
*
361+
* @param array $hook
362+
* @param \Webkul\Activity\Contracts\Activity $activity
357363
*
358-
* @param $hook
359-
* @param $quote
360364
* @return array
361365
*/
362366
private function getRequestBody($hook, $activity)
@@ -388,7 +392,7 @@ private function getRequestBody($hook, $activity)
388392
}
389393

390394
/**
391-
* Returns .ics file for attachments
395+
* Returns .ics file for attachments.
392396
*
393397
* @param \Webkul\Activity\Contracts\Activity $activity
394398
* @return string

packages/Webkul/Workflow/src/Helpers/Entity/Lead.php

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
class Lead extends AbstractEntity
1717
{
1818
/**
19-
* @var string $code
19+
* Define the entity type.
20+
*
21+
* @var string $entityType
2022
*/
2123
protected $entityType = 'leads';
2224

@@ -36,9 +38,9 @@ public function __construct(
3638
}
3739

3840
/**
39-
* Returns entity
41+
* Listing of the entities.
4042
*
41-
* @param \Webkul\Lead\Contracts\Lead|integer $entity
43+
* @param \Webkul\Lead\Contracts\Lead $entity
4244
* @return \Webkul\Lead\Contracts\Lead
4345
*/
4446
public function getEntity($entity)
@@ -51,7 +53,7 @@ public function getEntity($entity)
5153
}
5254

5355
/**
54-
* Returns attributes
56+
* Returns attributes.
5557
*
5658
* @param string $entityType
5759
* @param array $skipAttributes
@@ -74,7 +76,7 @@ public function getAttributes($entityType, $skipAttributes = ['textarea', 'image
7476
}
7577

7678
/**
77-
* Returns workflow actions
79+
* Returns workflow actions.
7880
*
7981
* @return array
8082
*/
@@ -124,7 +126,7 @@ public function getActions()
124126
}
125127

126128
/**
127-
* Execute workflow actions
129+
* Execute workflow actions.
128130
*
129131
* @param \Webkul\Workflow\Models\Workflow $workflow
130132
* @param \Webkul\Lead\Models\Lead $lead
@@ -238,10 +240,10 @@ public function executeActions($workflow, $lead)
238240
}
239241

240242
/**
241-
* trigger webhook
243+
* Trigger webhook.
242244
*
243-
* @param $hook
244-
* @param $lead
245+
* @param array $hook
246+
* @param \Webkul\Lead\Contracts\Lead $lead
245247
* @return void
246248
*/
247249
private function triggerWebhook($hook, $lead)
@@ -263,9 +265,9 @@ private function triggerWebhook($hook, $lead)
263265
}
264266

265267
/**
266-
* format headers
268+
* Format headers.
267269
*
268-
* @param $hook
270+
* @param array $hook
269271
* @return array
270272
*/
271273
private function formatHeaders($hook)
@@ -284,10 +286,10 @@ private function formatHeaders($hook)
284286
}
285287

286288
/**
287-
* prepare request body
289+
* Prepare request body.
288290
*
289-
* @param $hook
290-
* @param $lead
291+
* @param array $hook
292+
* @param \Webkul\Lead\Contracts\Lead $lead
291293
* @return array
292294
*/
293295
private function getRequestBody($hook, $lead)

packages/Webkul/Workflow/src/Helpers/Entity/Person.php

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
class Person extends AbstractEntity
1515
{
1616
/**
17-
* @var string $code
17+
* Define the entity type.
18+
*
19+
* @var string $entityType
1820
*/
1921
protected $entityType = 'persons';
2022

@@ -32,9 +34,9 @@ public function __construct(
3234
}
3335

3436
/**
35-
* Returns entity
37+
* Listing of the entities.
3638
*
37-
* @param \Webkul\Contact\Contracts\Person|integer $entity
39+
* @param \Webkul\Contact\Contracts\Person $entity
3840
* @return \Webkul\Contact\Contracts\Person
3941
*/
4042
public function getEntity($entity)
@@ -47,7 +49,7 @@ public function getEntity($entity)
4749
}
4850

4951
/**
50-
* Returns workflow actions
52+
* Returns workflow actions.
5153
*
5254
* @return array
5355
*/
@@ -87,7 +89,7 @@ public function getActions()
8789
}
8890

8991
/**
90-
* Execute workflow actions
92+
* Execute workflow actions.
9193
*
9294
* @param \Webkul\Workflow\Contracts\Workflow $workflow
9395
* @param \Webkul\Contact\Contracts\Person $person
@@ -152,10 +154,10 @@ public function executeActions($workflow, $person)
152154
}
153155

154156
/**
155-
* trigger webhook
157+
* Trigger webhook.
156158
*
157-
* @param $hook
158-
* @param $person
159+
* @param array $hook
160+
* @param \Webkul\Contact\Contracts\Person $person
159161
* @return void
160162
*/
161163
private function triggerWebhook($hook, $person)
@@ -198,10 +200,10 @@ private function formatHeaders($hook)
198200
}
199201

200202
/**
201-
* prepare request body
203+
* Prepare request body.
202204
*
203-
* @param $hook
204-
* @param $person
205+
* @param array $hook
206+
* @param \Webkul\Contact\Contracts\Person $person
205207
* @return array
206208
*/
207209
private function getRequestBody($hook, $person)

packages/Webkul/Workflow/src/Helpers/Entity/Quote.php

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
class Quote extends AbstractEntity
1616
{
1717
/**
18-
* @var string $code
18+
* Define the entity type.
19+
*
20+
* @var string $entityType
1921
*/
2022
protected $entityType = 'quotes';
2123

@@ -34,7 +36,7 @@ public function __construct(
3436
}
3537

3638
/**
37-
* Returns entity
39+
* Listing of the entities.
3840
*
3941
* @param \Webkul\Quote\Contracts\Quote|integer $entity
4042
* @return \Webkul\Quote\Contracts\Quote
@@ -49,7 +51,7 @@ public function getEntity($entity)
4951
}
5052

5153
/**
52-
* Returns workflow actions
54+
* Returns workflow actions.
5355
*
5456
* @return array
5557
*/
@@ -97,7 +99,7 @@ public function getActions()
9799
}
98100

99101
/**
100-
* Execute workflow actions
102+
* Execute workflow actions.
101103
*
102104
* @param \Webkul\Workflow\Contracts\Workflow $workflow
103105
* @param \Webkul\Quote\Contracts\Quote $quote
@@ -185,10 +187,10 @@ public function executeActions($workflow, $quote)
185187
}
186188

187189
/**
188-
* trigger webhook
190+
* Trigger webhook.
189191
*
190-
* @param $hook
191-
* @param $quote
192+
* @param array $hook
193+
* @param \Webkul\Quote\Contracts\Quote $quote
192194
* @return void
193195
*/
194196
private function triggerWebhook($hook, $quote)
@@ -210,9 +212,9 @@ private function triggerWebhook($hook, $quote)
210212
}
211213

212214
/**
213-
* format headers
215+
* Format headers.
214216
*
215-
* @param $hook
217+
* @param array $hook
216218
* @return array
217219
*/
218220
private function formatHeaders($hook)
@@ -231,10 +233,10 @@ private function formatHeaders($hook)
231233
}
232234

233235
/**
234-
* prepare request body
236+
* Prepare request body.
235237
*
236-
* @param $hook
237-
* @param $quote
238+
* @param array $hook
239+
* @param \Webkul\Quote\Contracts\Quote $quote
238240
* @return array
239241
*/
240242
private function getRequestBody($hook, $quote)

0 commit comments

Comments
 (0)