Basic::__construct( array|null $args = null )
Constructor
Parameters
- $args
-
(Optional) Array of user and password. Must have exactly two elements
Default value: null
Source
File: wp-includes/Requests/src/Auth/Basic.php
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));
}
}
Changelog
Version | Description |
---|---|
2.0 | Introduced. Throws an ArgumentCount exception instead of the Requests base `Exception. |