Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 21
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
Demo
0.00% covered (danger)
0.00%
0 / 21
0.00% covered (danger)
0.00%
0 / 3
12
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 fetchLinks
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 parseLinks
0.00% covered (danger)
0.00%
0 / 19
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3/**
4 * Demo Link 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
32namespace VuFind\Resolver\Driver;
33
34/**
35 * Demo Link 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 */
43class Demo extends AbstractBase
44{
45    /**
46     * Constructor
47     *
48     * @param string $baseUrl Base URL for link resolver
49     */
50    public function __construct($baseUrl = 'http://localhost')
51    {
52        parent::__construct($baseUrl);
53    }
54
55    /**
56     * Fetch Links
57     *
58     * Fetches a set of links corresponding to an OpenURL
59     *
60     * @param string $openURL openURL (url-encoded)
61     *
62     * @return string
63     */
64    public function fetchLinks($openURL)
65    {
66        return $openURL;
67    }
68
69    /**
70     * Parse Links
71     *
72     * Parses data returned by a link resolver
73     * and converts it to a standardised format for display
74     *
75     * @param string $data Raw data
76     *
77     * @return array       Array of values
78     */
79    public function parseLinks($data)
80    {
81        return [
82            [
83                'href' => 'https://vufind.org/wiki?' . $data . '#print',
84                'title' => 'Print',
85                'coverage' => 'fake1',
86                'service_type' => 'getHolding',
87                'access' => 'unknown',
88                'notes' => 'General notes',
89            ],
90            [
91                'href' => 'https://vufind.org/wiki?' . $data . '#electronic',
92                'title' => 'Electronic',
93                'coverage' => 'fake2',
94                'service_type' => 'getFullTxt',
95                'access' => 'open',
96                'authentication' => 'Authentication notes',
97                'notes' => 'General notes',
98            ],
99        ];
100    }
101}