HEX
Server: LiteSpeed
System: Linux server801.shared.spaceship.host 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: yvigantdvn (2232)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: /home/yvigantdvn/petermkufya.com/wp-content/plugins/timetics/base/forward-calls.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(
            /* translators: %1$s: Class name, %2$s: Method name */
            esc_html__( 'Call to undefined method %1$s::%2$s()', 'timetics' ), static::class, esc_html( $method )
        ) );
    }
}