Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
83.33% |
5 / 6 |
|
66.67% |
2 / 3 |
CRAP | |
0.00% |
0 / 1 |
AbstractBase | |
83.33% |
5 / 6 |
|
66.67% |
2 / 3 |
4.07 | |
0.00% |
0 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getResolverUrl | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
2 | |||
supportsMoreOptionsLink | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | /** |
4 | * AbstractBase for Resolver Driver |
5 | * |
6 | * PHP version 8 |
7 | * |
8 | * Copyright (C) Villanova University 2015. |
9 | * |
10 | * last update: 2011-04-13 |
11 | * |
12 | * This program is free software; you can redistribute it and/or modify |
13 | * it under the terms of the GNU General Public License version 2, |
14 | * as published by the Free Software Foundation. |
15 | * |
16 | * This program is distributed in the hope that it will be useful, |
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
19 | * GNU General Public License for more details. |
20 | * |
21 | * You should have received a copy of the GNU General Public License |
22 | * along with this program; if not, write to the Free Software |
23 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
24 | * |
25 | * @category VuFind |
26 | * @package Resolver_Drivers |
27 | * @author Demian Katz <demian.katz@villanova.edu> |
28 | * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
29 | * @link https://vufind.org/wiki/development:plugins:link_resolver_drivers Wiki |
30 | */ |
31 | |
32 | namespace VuFind\Resolver\Driver; |
33 | |
34 | /** |
35 | * AbstractBase for Resolver Driver |
36 | * |
37 | * @category VuFind |
38 | * @package Resolver_Drivers |
39 | * @author Demian Katz <demian.katz@villanova.edu> |
40 | * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
41 | * @link https://vufind.org/wiki/development:plugins:link_resolver_drivers Wiki |
42 | */ |
43 | abstract class AbstractBase implements DriverInterface |
44 | { |
45 | /** |
46 | * Base URL for link resolver |
47 | * |
48 | * @var string |
49 | */ |
50 | protected $baseUrl; |
51 | |
52 | /** |
53 | * Constructor |
54 | * |
55 | * @param string $baseUrl Base URL for link resolver |
56 | */ |
57 | public function __construct($baseUrl) |
58 | { |
59 | $this->baseUrl = $baseUrl; |
60 | } |
61 | |
62 | /** |
63 | * Get Resolver Url |
64 | * |
65 | * Transform the OpenURL as needed to get a working link to the resolver. |
66 | * |
67 | * @param string $openURL openURL (url-encoded) |
68 | * |
69 | * @return string Returns resolver specific url |
70 | */ |
71 | public function getResolverUrl($openURL) |
72 | { |
73 | $url = $this->baseUrl; |
74 | $url .= !str_contains($url, '?') ? '?' : '&'; |
75 | $url .= $openURL; |
76 | return $url; |
77 | } |
78 | |
79 | /** |
80 | * This controls whether a "More options" link will be shown below the fetched |
81 | * resolver links eventually linking to the resolver page previously being |
82 | * parsed. |
83 | * This is especially useful for resolver such as the JOP resolver returning |
84 | * XML which would not be of any immediate use for the user. |
85 | * |
86 | * @return bool |
87 | */ |
88 | public function supportsMoreOptionsLink() |
89 | { |
90 | return true; |
91 | } |
92 | } |