HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/vcz/wp-content/plugins/wordpress-seo/vendor/yoast/whip/src/Messages/BasicMessage.php
<?php

namespace Yoast\WHIPv2\Messages;

use Yoast\WHIPv2\Exceptions\EmptyProperty;
use Yoast\WHIPv2\Exceptions\InvalidType;
use Yoast\WHIPv2\Interfaces\Message;

/**
 * Class BasicMessage.
 */
class BasicMessage implements Message {

	/**
	 * Message body.
	 *
	 * @var string
	 */
	private $body;

	/**
	 * Message constructor.
	 *
	 * @param string $body Message body.
	 */
	public function __construct( $body ) {
		$this->validateParameters( $body );

		$this->body = $body;
	}

	/**
	 * Retrieves the message body.
	 *
	 * @return string Message.
	 */
	public function body() {
		return $this->body;
	}

	/**
	 * Validates the parameters passed to the constructor of this class.
	 *
	 * @param string $body Message body.
	 *
	 * @return void
	 *
	 * @throws EmptyProperty When the $body parameter is empty.
	 * @throws InvalidType   When the $body parameter is not of the expected type.
	 */
	private function validateParameters( $body ) {
		if ( empty( $body ) ) {
			throw new EmptyProperty( 'Message body' );
		}

		if ( ! \is_string( $body ) ) {
			throw new InvalidType( 'Message body', $body, 'string' );
		}
	}
}