PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.9
GiveWP – Donation Plugin and Fundraising Platform v4.16.9
4.16.9 4.16.8.1 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 All 255 releases
give / src / Donations / Properties / BillingAddress.php

BillingAddress.php in GiveWP – Donation Plugin and Fundraising Platform 4.16.9, at src/Donations/Properties/BillingAddress.php

84 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\Donations\Properties;
4
5 use Give\Framework\Support\Contracts\Arrayable;
6 use JsonSerializable;
7
8 /**
9 * @since 3.20.0 added JsonSerializable an Arrayable
10 * @since 2.19.6
11 */
12 final class BillingAddress implements JsonSerializable, Arrayable
13 {
14 /**
15 * @var string
16 */
17 public $country;
18 /**
19 * @var string
20 */
21 public $address1;
22 /**
23 * @var string
24 */
25 public $address2;
26 /**
27 * @var string
28 */
29 public $city;
30 /**
31 * @var string
32 */
33 public $state;
34 /**
35 * @var string
36 */
37 public $zip;
38
39 /**
40 * @since 2.19.6
41 *
42 * @param array $array
43 *
44 * @return BillingAddress
45 */
46 public static function fromArray($array)
47 {
48 $self = new static();
49
50 $self->country = $array['country'];
51 $self->address1 = $array['address1'];
52 $self->address2 = $array['address2'];
53 $self->city = $array['city'];
54 $self->state = $array['state'];
55 $self->zip = $array['zip'];
56
57 return $self;
58 }
59
60 /**
61 * @since 3.20.0
62 */
63 public function toArray(): array
64 {
65 return [
66 'country' => $this->country,
67 'address1' => $this->address1,
68 'address2' => $this->address2,
69 'city' => $this->city,
70 'state' => $this->state,
71 'zip' => $this->zip,
72 ];
73 }
74
75 /**
76 * @since 3.20.0
77 */
78 #[\ReturnTypeWillChange]
79 public function jsonSerialize()
80 {
81 return $this->toArray();
82 }
83 }
84