1
0
mirror of https://github.com/miguel456/php-http-virtualmin-api synced 2023-07-28 01:52:31 +00:00

registered Nilemin\Virtualmin\Http\HttpClientInterface in the dependency injection container

This commit is contained in:
Tsvetelin Tsonev 2018-04-21 12:16:14 +02:00 committed by GitHub
parent e43be86156
commit bf453ce944
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,7 +11,7 @@ use Nilemin\Virtualmin\Managers\DNS\DNSManager;
use Nilemin\Virtualmin\Managers\SSL\SSLManager;
use Nilemin\Virtualmin\Managers\Scripts\ScriptsManager;
use Nilemin\Virtualmin\Managers\Cron\CronManager;
use Nilemin\Virtualmin\Http\HttpClient;
use Nilemin\Virtualmin\Http\HttpClientInterface;
use Nilet\Components\Configuration\Config;
use Nilet\Components\Container\DependencyContainer;
@ -22,7 +22,7 @@ class Virtualmin {
/**
* Http client.
* @var HttpClient
* @var Nilemin\Virtualmin\Http\HttpClientInterface
*/
private $httpClient = null;
@ -41,6 +41,7 @@ class Virtualmin {
$this->httpClient = new HttpClient($url, $port, $rootName, $rootPassword, "json");
$this->dc = new DependencyContainer();
$this->dc->instance(Config::class, $config);
$this->dc->instance("Nilemin\\Virtualmin\\Http\\HttpClientInterface", function() { return $this->httpClient; });
}
/**