PluginProbe
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution / 1.5.21
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution v1.5.21
2.4.0 2.3.0 2.2.5 2.2.0 2.1.2 2.1.1 trunk 1.10.0 1.10.01 1.10.02 1.5.0 1.5.01 1.5.02 1.5.1 1.5.10 1.5.20 1.5.21 1.5.22 1.5.23 1.5.24 1.5.25 1.6.0 1.7.0 1.7.1 1.7.2 All 33 releases
fluent-booking / vendor / wpfluent / framework / src / WPFluent / Support / HigherOrderWhenProxy.php

HigherOrderWhenProxy.php in Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution 1.5.21, at vendor/wpfluent/framework/src/WPFluent/Support/HigherOrderWhenProxy.php

66 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentBooking\Framework\Support;
4
5 Use FluentBooking\Framework\Support\Enumerable;
6
7 /**
8 * @mixin \FluentBooking\Framework\Support\Enumerable
9 */
10 class HigherOrderWhenProxy
11 {
12 /**
13 * The collection being operated on.
14 *
15 * @var \FluentBooking\Framework\Support\Enumerable
16 */
17 protected $collection;
18
19 /**
20 * The condition for proxying.
21 *
22 * @var bool
23 */
24 protected $condition;
25
26 /**
27 * Create a new proxy instance.
28 *
29 * @param \FluentBooking\Framework\Support\Enumerable $collection
30 * @param bool $condition
31 * @return void
32 */
33 public function __construct(Enumerable $collection, $condition)
34 {
35 $this->condition = $condition;
36 $this->collection = $collection;
37 }
38
39 /**
40 * Proxy accessing an attribute onto the collection.
41 *
42 * @param string $key
43 * @return mixed
44 */
45 public function __get($key)
46 {
47 return $this->condition
48 ? $this->collection->{$key}
49 : $this->collection;
50 }
51
52 /**
53 * Proxy a method call onto the collection.
54 *
55 * @param string $method
56 * @param array $parameters
57 * @return mixed
58 */
59 public function __call($method, $parameters)
60 {
61 return $this->condition
62 ? $this->collection->{$method}(...$parameters)
63 : $this->collection;
64 }
65 }
66