WpOrg\Requests\Auth

Basic::__construct()publicWP 2.0

Constructor

Method of the class: Basic{}

No Hooks.

Return

null. Nothing (null).

Usage

$Basic = new Basic();
$Basic->__construct( $args );
$args(array|null)
Array of user and password. Must have exactly two elements
Default: null

Changelog

Since 2.0 Introduced.
Since 2.0 Throws an InvalidArgument exception.
Since 2.0 Throws an ArgumentCount exception instead of the Requests base `Exception.

Basic::__construct() code WP 6.6.2

public function __construct($args = null) {
	if (is_array($args)) {
		if (count($args) !== 2) {
			throw ArgumentCount::create('an array with exactly two elements', count($args), 'authbasicbadargs');
		}

		list($this->user, $this->pass) = $args;
		return;
	}

	if ($args !== null) {
		throw InvalidArgument::create(1, '$args', 'array|null', gettype($args));
	}
}