PluginProbe
Booktics – Appointment Booking Calendar for Service Businesses / 1.0.0
Booktics – Appointment Booking Calendar for Service Businesses v1.0.0
1.0.29 1.0.28 1.0.27 1.0.26 1.0.25 1.0.24 1.0.23 1.0.22 1.0.21 1.0.20 1.0.19 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.2 1.0.3 All 31 releases
booktics / vendor / themewinter / email-notification-sdk / src / Base / ForwardCalls.php

ForwardCalls.php in Booktics – Appointment Booking Calendar for Service Businesses 1.0.0, at vendor/themewinter/email-notification-sdk/src/Base/ForwardCalls.php

58 lines 1.3 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 use ENS\Config;
8
9 /**
10 * ForwardCalls Trait
11 *
12 * @since 1.0.0
13 *
14 * @package ENS
15 */
16 trait ForwardCalls {
17
18 /**
19 * Handle dynamic method
20 *
21 * @since 1.0.0
22 *
23 * @param PostModel $model
24 * @param string $method
25 * @param mixed $params
26 *
27 * @return mixed
28 */
29 protected static function forward_call_to_static( PostModel $model, $method, $params ) {
30 try {
31 $post = new Post( $model );
32
33 return $post->$method( ...$params );
34
35 } catch ( BadMethodCallException $e ) {
36 static::throw_bad_method_call_exception( $method );
37 }
38 }
39
40 /**
41 * Throw a bad method call exception for the given method.
42 *
43 * @since 1.0.0
44 *
45 * @param string $method
46 * @return void
47 *
48 * @throws \BadMethodCallException
49 */
50 protected static function throw_bad_method_call_exception( $method ) {
51 throw new BadMethodCallException( esc_html( sprintf(
52 // translators: %1$s is the class name, %2$s is the method name
53 __( 'Call to undefined method %1$s::%2$s()', Config::get( 'text_domain' ) ),
54 static::class,
55 $method
56 ) ) );
57 }
58 }