You've already forked redmine-bundle
use new Psr18Client
This commit is contained in:
@@ -2,9 +2,43 @@
|
||||
|
||||
namespace Magdev\RedmineBundle\Client;
|
||||
|
||||
use Redmine\Client\NativeCurlClient;
|
||||
use Redmine\Client\Psr18Client;
|
||||
use GuzzleHttp\Client as GuzzleClient;
|
||||
use GuzzleHttp\Psr7\HttpFactory as GuzzleHttpFactory;
|
||||
|
||||
class RedmineClient extends NativeCurlClient
|
||||
final class RedmineClient
|
||||
{
|
||||
private ?Psr18Client $client = null;
|
||||
|
||||
public function __construct(
|
||||
string $url,
|
||||
string $apikeyOrUsername,
|
||||
?string $password = null
|
||||
) {
|
||||
$guzzle = new GuzzleClient();
|
||||
$factory = new GuzzleHttpFactory();
|
||||
|
||||
$this->client = new Psr18Client(
|
||||
$guzzle,
|
||||
$factory,
|
||||
$factory,
|
||||
$url,
|
||||
$apikeyOrUsername,
|
||||
$password
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function __call($name, $arguments)
|
||||
{
|
||||
if (!method_exists($this->client, $name)) {
|
||||
throw new \BadMethodCallException(sprintf(
|
||||
'Method %s, doesn\'t exist in class %s',
|
||||
$name,
|
||||
get_class($this->client)
|
||||
));
|
||||
}
|
||||
|
||||
return call_user_func_array([$this->client, $name], $arguments);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user