-
Notifications
You must be signed in to change notification settings - Fork 401
Use config array instead of object for Relais Connection module #5657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rtloftus
wants to merge
5
commits into
vufind-org:dev
Choose a base branch
from
rtloftus:relais-connection
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+15
−31
Open
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0213bc8
Use config array instead of object for Relais Connection module
rtloftus 23aafa5
composer fix
rtloftus 2aa5c1e
factory fix
rtloftus 3f220de
Update module/VuFind/src/VuFind/Connection/RelaisFactory.php
rtloftus 9d8b966
object to array fix
rtloftus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,30 +45,14 @@ class Relais implements \Psr\Log\LoggerAwareInterface | |
| { | ||
| use \VuFind\Log\LoggerAwareTrait; | ||
|
|
||
| /** | ||
| * HTTP client. | ||
| * | ||
| * @var Client | ||
| */ | ||
| protected $client; | ||
|
|
||
| /** | ||
| * Relais configuration. | ||
| * | ||
| * @var Config | ||
| */ | ||
| protected $config; | ||
|
|
||
| /** | ||
| * Constructor. | ||
| * | ||
| * @param Client $client HTTP client | ||
| * @param Config $config Relais configuration | ||
| * @param array $config Relais configuration | ||
| */ | ||
| public function __construct(Client $client, Config $config) | ||
| public function __construct(protected Client $client, protected array $config) | ||
| { | ||
| $this->client = $client; | ||
| $this->config = $config; | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -79,10 +63,10 @@ public function __construct(Client $client, Config $config) | |
| protected function getDefaultData() | ||
| { | ||
| return [ | ||
| 'ApiKey' => $this->config->apikey ?? null, | ||
| 'ApiKey' => $this->config['apikey'] ?? null, | ||
| 'UserGroup' => 'PATRON', | ||
| 'PartnershipId' => $this->config->group ?? null, | ||
| 'LibrarySymbol' => $this->config->symbol ?? null, | ||
| 'PartnershipId' => $this->config['group'] ?? null, | ||
| 'LibrarySymbol' => $this->config['symbol'] ?? null, | ||
| ]; | ||
| } | ||
|
|
||
|
|
@@ -97,9 +81,9 @@ protected function getDefaultData() | |
| protected function getOclcRequestData($oclc, $patron) | ||
| { | ||
| return [ | ||
| 'PickupLocation' => $this->config->pickupLocation ?? null, | ||
| 'PickupLocation' => $this->config['pickupLocation'] ?? null, | ||
| 'Notes' => 'This request was made through the VuFind Catalog interface', | ||
| 'PatronId' => $patron ?? $this->config->patronForLookup ?? null, | ||
| 'PatronId' => $patron ?? $this->config['patronForLookup'] ?? null, | ||
| 'ExactSearch' => [ | ||
| [ | ||
| 'Type' => 'OCLC', | ||
|
|
@@ -145,11 +129,11 @@ protected function request($uri, $data) | |
| */ | ||
| public function authenticatePatron($patron = null, $returnFullObject = false) | ||
| { | ||
| $uri = $this->config->authenticateurl ?? null; | ||
| $uri = $this->config['authenticateurl'] ?? null; | ||
| if (empty($uri)) { | ||
| throw new \Exception('authenticateurl not configured!'); | ||
| } | ||
| $data = ['PatronId' => $patron ?? $this->config->patronForLookup ?? null]; | ||
| $data = ['PatronId' => $patron ?? $this->config['patronForLookup'] ?? null]; | ||
| $result = json_decode($this->request($uri, $data)); | ||
| return $returnFullObject ? $result : ($result->AuthorizationId ?? null); | ||
| } | ||
|
|
@@ -166,7 +150,7 @@ public function authenticatePatron($patron = null, $returnFullObject = false) | |
| */ | ||
| public function placeRequest($oclc, $auth, $patron = null) | ||
| { | ||
| $uri = $this->config->addurl ?? null; | ||
| $uri = $this->config['addurl'] ?? null; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Take a look at line 173 below -- I think there's one last object-style reference that still needs to be converted. |
||
| if (empty($uri)) { | ||
| throw new \Exception('addurl not configured!'); | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.