Skip to content
Snippets Groups Projects
Commit 989bd627 authored by Robert Lange's avatar Robert Lange
Browse files

refs #26470 update for php 8

* sync with vufind, remove obsolete bridge
parent 8db5ee6a
Branches issue/26470
Tags
1 merge request!1refs #26470 update for php 8
......@@ -10,16 +10,17 @@
{
"name": "Pascal Kanter",
"email": "kanter@ub.uni-leipzig.de"
},
{
"name": "Robert Lange",
"email": "lange@ub.uni-leipzig.de"
}
],
"require": {
"php": ">=7.1",
"finc/vufindhttp-psrcompat": "^0.0",
"psr/http-client": "^1.0",
"guzzlehttp/psr7": "^1.4",
"ext-json": "*",
"finc/symfony-serializer-zend-bridge": "^0.0.1",
"symfony/property-info": "^3.4"
"php": "^7.3 || ^8.0",
"vufind-org/vufindhttp": "*",
"finc/symfony-serializer-zend-bridge": "^2.0",
"ext-json": "*"
},
"autoload": {
"psr-4": {
......@@ -28,7 +29,7 @@
},
"autoload-dev": {
"psr-4": {
"finc\\Boss\\tests": "tests/"
"finc\\Boss\\tests\\": "tests/"
}
},
"scripts": {
......
......@@ -21,12 +21,10 @@
namespace finc\Boss\Client;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Uri;
use Psr\Http\Client\ClientInterface;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
use Symfony\Component\Serializer\SerializerInterface;
use VuFindHttp\HttpServiceInterface as HttpService;
/**
* "Get Boss data" AJAX Handler
......@@ -45,9 +43,9 @@ class BossClient
/**
*
* @var ClientInterface
* @var HttpService
*/
protected $httpClient;
protected $httpService;
/**
* @var SerializerInterface
......@@ -57,16 +55,15 @@ class BossClient
/**
* Client constructor.
*
* @param ClientInterface $httpClient
* @param SerializerInterface $serializer
* @param HttpService $httpService
* @param SerializerInterface $serializer
*/
public function __construct(
ClientInterface $httpClient,
HttpService $httpService,
SerializerInterface $serializer
) {
$this->httpClient = $httpClient;
$this->httpService = $httpService;
$this->serializer = $serializer;
$this->baseUrl = new Uri(static::BOSS_URL);
}
/**
......@@ -82,10 +79,14 @@ class BossClient
{
$retval = [];
foreach ($isxns as $isxn) {
$uri = static::BOSS_URL . "?isxn[]=$isxn&network=$network";
$client = $this->httpService->createClient(
$uri
);
$uri = $this->baseUrl->withQuery("isxn[]=$isxn&network=$network");
$request = new Request('GET', $uri);
$response = $this->httpClient->sendRequest($request);
/* @var \Laminas\Http\Response $response */
$response = $client->send();
if ($response->getStatusCode() == "200") {
$data = $this->lookupData($response);
......
......@@ -20,8 +20,7 @@
*/
namespace finc\Boss\Client;
use Interop\Container\ContainerInterface;
use Psr\Http\Client\ClientInterface;
use Psr\Container\ContainerInterface;
use Symfony\Component\Serializer\SerializerInterface;
/**
......@@ -45,10 +44,9 @@ class BossClientFactory
*/
public function __invoke(ContainerInterface $container)
{
/** @var ClientInterface $httpClient */
$httpClient = $container->get(ClientInterface::class);
/** @var SerializerInterface $serializer */
$serializer = $container->get(SerializerInterface::class);
return new BossClient($httpClient, $serializer);
return new BossClient(
$container->get(\VuFindHttp\HttpService::class),
$container->get(SerializerInterface::class)
);
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment