PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.15.5
GiveWP – Donation Plugin and Fundraising Platform v4.15.5
4.18.0 4.17.0 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 All 257 releases
give / src / PaymentGateways / PayPalCommerce / Repositories / Traits / HasMode.php

HasMode.php in GiveWP – Donation Plugin and Fundraising Platform 4.15.5, at src/PaymentGateways/PayPalCommerce/Repositories/Traits/HasMode.php

48 lines 905 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\PaymentGateways\PayPalCommerce\Repositories\Traits;
4
5 use Give\Framework\Exceptions\Primitives\InvalidArgumentException;
6
7 trait HasMode
8 {
9 /**
10 * The current working mode: live or sandbox
11 *
12 * @since 2.9.0
13 *
14 * @var string
15 */
16 protected $mode;
17
18 /**
19 * Sets the mode for the repository for handling operations
20 *
21 * @since 2.9.0
22 *
23 * @param $mode
24 *
25 * @return $this
26 */
27 public function setMode($mode)
28 {
29 if (! in_array($mode, ['live', 'sandbox'], true)) {
30 throw new InvalidArgumentException("Must be either 'live' or 'sandbox', received: $mode");
31 }
32
33 $this->mode = $mode;
34
35 return $this;
36 }
37
38 /**
39 * This function returns the current mode
40 *
41 * @since 2.30.0
42 */
43 public function getMode(): string
44 {
45 return $this->mode;
46 }
47 }
48