PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 2.23.0
GiveWP – Donation Plugin and Fundraising Platform v2.23.0
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 / Framework / FieldsAPI / Option.php

Option.php in GiveWP – Donation Plugin and Fundraising Platform 2.23.0, at src/Framework/FieldsAPI/Option.php

65 lines 995 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\Framework\FieldsAPI;
4
5 use JsonSerializable;
6
7 /**
8 * Class Option
9 *
10 * @since 2.12.0
11 */
12 class Option implements JsonSerializable
13 {
14
15 use Concerns\HasLabel;
16
17 /** @var string */
18 protected $value;
19
20 /**
21 * @param string $value
22 * @param ?string $label
23 */
24 public function __construct($value, $label = null)
25 {
26 $this->value = $value;
27 $this->label = $label;
28 }
29
30 /**
31 * Create a new option.
32 *
33 * @since 2.12.0
34 *
35 * @return static
36 */
37 public static function make(...$args)
38 {
39 return new static(...$args);
40 }
41
42 /**
43 * Access the value
44 *
45 * @since 2.12.0
46 *
47 * @return string
48 */
49 public function getValue()
50 {
51 return $this->value;
52 }
53
54 /**
55 * {@inheritdoc}
56 */
57 public function jsonSerialize()
58 {
59 return [
60 'value' => $this->getValue(),
61 'label' => $this->getLabel(),
62 ];
63 }
64 }
65