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 @@ ...@@ -10,16 +10,17 @@
{ {
"name": "Pascal Kanter", "name": "Pascal Kanter",
"email": "kanter@ub.uni-leipzig.de" "email": "kanter@ub.uni-leipzig.de"
},
{
"name": "Robert Lange",
"email": "lange@ub.uni-leipzig.de"
} }
], ],
"require": { "require": {
"php": ">=7.1", "php": "^7.3 || ^8.0",
"finc/vufindhttp-psrcompat": "^0.0", "vufind-org/vufindhttp": "*",
"psr/http-client": "^1.0", "finc/symfony-serializer-zend-bridge": "^2.0",
"guzzlehttp/psr7": "^1.4", "ext-json": "*"
"ext-json": "*",
"finc/symfony-serializer-zend-bridge": "^0.0.1",
"symfony/property-info": "^3.4"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
...@@ -28,7 +29,7 @@ ...@@ -28,7 +29,7 @@
}, },
"autoload-dev": { "autoload-dev": {
"psr-4": { "psr-4": {
"finc\\Boss\\tests": "tests/" "finc\\Boss\\tests\\": "tests/"
} }
}, },
"scripts": { "scripts": {
......
...@@ -21,12 +21,10 @@ ...@@ -21,12 +21,10 @@
namespace finc\Boss\Client; 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\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
use Symfony\Component\Serializer\SerializerInterface; use Symfony\Component\Serializer\SerializerInterface;
use VuFindHttp\HttpServiceInterface as HttpService;
/** /**
* "Get Boss data" AJAX Handler * "Get Boss data" AJAX Handler
...@@ -45,9 +43,9 @@ class BossClient ...@@ -45,9 +43,9 @@ class BossClient
/** /**
* *
* @var ClientInterface * @var HttpService
*/ */
protected $httpClient; protected $httpService;
/** /**
* @var SerializerInterface * @var SerializerInterface
...@@ -57,16 +55,15 @@ class BossClient ...@@ -57,16 +55,15 @@ class BossClient
/** /**
* Client constructor. * Client constructor.
* *
* @param ClientInterface $httpClient * @param HttpService $httpService
* @param SerializerInterface $serializer * @param SerializerInterface $serializer
*/ */
public function __construct( public function __construct(
ClientInterface $httpClient, HttpService $httpService,
SerializerInterface $serializer SerializerInterface $serializer
) { ) {
$this->httpClient = $httpClient; $this->httpService = $httpService;
$this->serializer = $serializer; $this->serializer = $serializer;
$this->baseUrl = new Uri(static::BOSS_URL);
} }
/** /**
...@@ -82,10 +79,14 @@ class BossClient ...@@ -82,10 +79,14 @@ class BossClient
{ {
$retval = []; $retval = [];
foreach ($isxns as $isxn) { 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"); /* @var \Laminas\Http\Response $response */
$request = new Request('GET', $uri); $response = $client->send();
$response = $this->httpClient->sendRequest($request);
if ($response->getStatusCode() == "200") { if ($response->getStatusCode() == "200") {
$data = $this->lookupData($response); $data = $this->lookupData($response);
......
...@@ -20,8 +20,7 @@ ...@@ -20,8 +20,7 @@
*/ */
namespace finc\Boss\Client; namespace finc\Boss\Client;
use Interop\Container\ContainerInterface; use Psr\Container\ContainerInterface;
use Psr\Http\Client\ClientInterface;
use Symfony\Component\Serializer\SerializerInterface; use Symfony\Component\Serializer\SerializerInterface;
/** /**
...@@ -45,10 +44,9 @@ class BossClientFactory ...@@ -45,10 +44,9 @@ class BossClientFactory
*/ */
public function __invoke(ContainerInterface $container) public function __invoke(ContainerInterface $container)
{ {
/** @var ClientInterface $httpClient */ return new BossClient(
$httpClient = $container->get(ClientInterface::class); $container->get(\VuFindHttp\HttpService::class),
/** @var SerializerInterface $serializer */ $container->get(SerializerInterface::class)
$serializer = $container->get(SerializerInterface::class); );
return new BossClient($httpClient, $serializer);
} }
} }
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