Revert "Share REST call code and separate components via dependency injection"

This commit is contained in:
Lorenzo Yario
2024-03-30 22:24:20 -07:00
committed by GitHub
parent 3d2f0b6a1b
commit f5328a436c
6 changed files with 104 additions and 393 deletions

View File

@@ -1,28 +0,0 @@
<?php
namespace Vichan;
defined('TINYBOARD') or exit;
use Vichan\Driver\{HttpDriver, HttpDrivers};
interface Context {
public function getHttpDriver(): HttpDriver;
}
class AppContext implements Context {
private array $config;
private ?HttpDriver $http;
public function __construct(array $config) {
$this->config = $config;
}
public function getHttpDriver(): HttpDriver {
if (is_null($this->http)) {
$this->http = HttpDrivers::getHttpDriver($this->config['upload_by_url_timeout'], $this->config['max_filesize']);
}
return $this->http;
}
}