PluginProbe
Timetics – Appointment Booking Calendar & Scheduling / 1.0.62
Timetics – Appointment Booking Calendar & Scheduling v1.0.62
1.0.62 1.0.63 1.0.61 1.0.60 1.0.59 1.0.58 1.0.57 1.0.56 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.2 1.0.20 1.0.21 1.0.22 All 64 releases
timetics / vendor / themewinter / email-notification-sdk / src / Base / ForwardCalls.php

ForwardCalls.php in Timetics – Appointment Booking Calendar & Scheduling 1.0.62, at vendor/themewinter/email-notification-sdk/src/Base/ForwardCalls.php

57 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Ens\Base;
4
5 use BadMethodCallException;
6 use Ens\Base\PostModel;
7
8 /**
9 * ForwardCalls Trait
10 *
11 * @since 1.0.0
12 *
13 * @package ENS
14 */
15 trait ForwardCalls {
16
17 /**
18 * Handle dynamic method
19 *
20 * @since 1.0.0
21 *
22 * @param PostModel $model
23 * @param string $method
24 * @param mixed $params
25 *
26 * @return mixed
27 */
28 protected static function forward_call_to_static( PostModel $model, $method, $params ) {
29 try {
30 $post = new Post( $model );
31
32 return $post->$method( ...$params );
33
34 } catch ( BadMethodCallException $e ) {
35 static::throw_bad_method_call_exception( $method );
36 }
37 }
38
39 /**
40 * Throw a bad method call exception for the given method.
41 *
42 * @since 1.0.0
43 *
44 * @param string $method
45 * @return void
46 *
47 * @throws \BadMethodCallException
48 */
49 protected static function throw_bad_method_call_exception( $method ) {
50 throw new BadMethodCallException( esc_html( sprintf(
51 // translators: %1$s is the class name, %2$s is the method name
52 'Call to undefined method %1$s::%2$s()',
53 static::class,
54 $method
55 ) ) );
56 }
57 }