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/Configuration.php
<?php

namespace Yoast\WHIPv2;

use Yoast\WHIPv2\Exceptions\InvalidType;
use Yoast\WHIPv2\Interfaces\Requirement;

/**
 * Class Configuration.
 */
class Configuration {

	/**
	 * The configuration to use.
	 *
	 * @var array<string>
	 */
	private $configuration;

	/**
	 * Configuration constructor.
	 *
	 * @param array<string, string> $configuration The configuration to use.
	 *
	 * @throws InvalidType When the $configuration parameter is not of the expected type.
	 */
	public function __construct( $configuration = array() ) {
		if ( ! \is_array( $configuration ) ) {
			throw new InvalidType( 'Configuration', $configuration, 'array' );
		}

		$this->configuration = $configuration;
	}

	/**
	 * Retrieves the configured version of a particular requirement.
	 *
	 * @param Requirement $requirement The requirement to check.
	 *
	 * @return string|int The version of the passed requirement that was detected as a string.
	 *                    If the requirement does not exist, this returns int -1.
	 */
	public function configuredVersion( Requirement $requirement ) {
		if ( ! $this->hasRequirementConfigured( $requirement ) ) {
			return -1;
		}

		return $this->configuration[ $requirement->component() ];
	}

	/**
	 * Determines whether the passed requirement is present in the configuration.
	 *
	 * @param Requirement $requirement The requirement to check.
	 *
	 * @return bool Whether or not the requirement is present in the configuration.
	 */
	public function hasRequirementConfigured( Requirement $requirement ) {
		return \array_key_exists( $requirement->component(), $this->configuration );
	}
}