PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.15.2
GiveWP – Donation Plugin and Fundraising Platform v4.15.2
4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 2.31.0 2.31.1 All 253 releases
give / src / Campaigns / Actions / ConvertQueryDataToCampaign.php
ConvertQueryDataToCampaign.php
42 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\Campaigns\Actions;
4
5 use Give\Campaigns\Models\Campaign;
6 use Give\Campaigns\ValueObjects\CampaignGoalType;
7 use Give\Campaigns\ValueObjects\CampaignStatus;
8 use Give\Campaigns\ValueObjects\CampaignType;
9 use Give\Framework\Support\Facades\DateTime\Temporal;
10
11 /**
12 * @since 4.0.0
13 */
14 class ConvertQueryDataToCampaign
15 {
16 /**
17 * @since 4.0.0
18 */
19 public function __invoke(object $queryObject): Campaign
20 {
21 return new Campaign([
22 'id' => (int)$queryObject->id,
23 'pageId' => $queryObject->pageId ? (int)$queryObject->pageId : null,
24 'defaultFormId' => $queryObject->defaultFormId ? (int)$queryObject->defaultFormId : null,
25 'type' => new CampaignType($queryObject->type),
26 'title' => $queryObject->title,
27 'shortDescription' => $queryObject->shortDescription,
28 'longDescription' => $queryObject->longDescription,
29 'logo' => $queryObject->logo,
30 'image' => $queryObject->image,
31 'primaryColor' => $queryObject->primaryColor,
32 'secondaryColor' => $queryObject->secondaryColor,
33 'goal' => (int)$queryObject->goal,
34 'goalType' => new CampaignGoalType($queryObject->goalType),
35 'startDate' => $queryObject->startDate ? Temporal::toDateTime($queryObject->startDate) : null,
36 'endDate' => $queryObject->endDate ? Temporal::toDateTime($queryObject->endDate) : null,
37 'status' => new CampaignStatus($queryObject->status),
38 'createdAt' => Temporal::toDateTime($queryObject->createdAt),
39 ]);
40 }
41 }
42