# timetics/1.0.16/base/forward-calls.php

Timetics – Appointment Booking Calendar &amp; Scheduling, version 1.0.16. 50 lines.

- Page: https://pluginprobe.com/plugins/timetics/1.0.16/code/base/forward-calls.php
- Raw: https://pluginprobe.com/plugins/timetics/1.0.16/raw/base/forward-calls.php
- Modified: 2024-01-03T04:11:06+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/timetics/1.0.16/code/base/forward-calls.php#L10-L20`.

```php
<?php
/**
 * ForwardCalls Trait
 *
 * @package Timetics
 */
namespace Timetics\Base;

use BadMethodCallException;
use Timetics\Base\PostModel;

/**
 * ForwardCalls Trait
 */
trait ForwardCalls {
    /**
     * Handle dynamic method
     *
     * @param   PostModel  $model
     * @param   string $method
     * @param   mixed $params
     *
     * @return  mixed
     */
    protected static function forwardCallToStatic( PostModel $model, $method, $params ) {
        try {
            $post = new Post( $model );

            return $post->$method( ...$params );

        } catch ( BadMethodCallException $e ) {
            static::throwBadMethodCallException( $method );
        }
    }

    /**
     * Throw a bad method call exception for the given method.
     *
     * @param  string  $method
     * @return void
     *
     * @throws \BadMethodCallException
     */
    protected static function throwBadMethodCallException( $method ) {
        throw new BadMethodCallException( sprintf(
            esc_html__( 'Call to undefined method %s::%s()', 'timetics' ), static::class, $method
        ) );
    }
}

```
