Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (210)

Classes/Api/Orcid/Client.php (1 issue)

Labels
Severity
1
<?php
2
3
/**
4
 * (c) Kitodo. Key to digital objects e.V. <[email protected]>
5
 *
6
 * This file is part of the Kitodo and TYPO3 projects.
7
 *
8
 * @license GNU General Public License version 3 or later.
9
 * For the full copyright and license information, please read the
10
 * LICENSE.txt file that was distributed with this source code.
11
 */
12
13
namespace Kitodo\Dlf\Api\Orcid;
14
15
use Psr\Http\Message\RequestFactoryInterface;
16
use TYPO3\CMS\Core\Http\RequestFactory;
17
use TYPO3\CMS\Core\Log\Logger;
18
use TYPO3\CMS\Core\Log\LogManager;
19
use TYPO3\CMS\Core\Utility\GeneralUtility;
20
21
/**
22
 * ORCID API Client class
23
 *
24
 * @package TYPO3
25
 * @subpackage dlf
26
 *
27
 * @access public
28
 **/
29
class Client
30
{
31
    /**
32
     * @var string constant for API hostname
33
     **/
34
    const HOSTNAME = 'orcid.org';
35
36
    /**
37
     * @var string constant for API version
38
     **/
39
    const VERSION = '3.0';
40
41
    /**
42
     * @access protected
43
     * @var Logger This holds the logger
44
     */
45
    protected Logger $logger;
46
47
    /**
48
     * @access private
49
     * @var string The ORCID API endpoint
50
     **/
51
    private string $endpoint = 'record';
52
53
    /**
54
     * @access private
55
     * @var string The ORCID API access level
56
     **/
57
    private string $level = 'pub';
58
59
    /**
60
     * @access private
61
     * @var string The ORCID ID to search for
62
     **/
63
    private string $orcid;
64
65
    /**
66
     * @access private
67
     * @var RequestFactoryInterface The request object
68
     **/
69
    private RequestFactoryInterface $requestFactory;
70
71
    /**
72
     * Constructs a new instance
73
     *
74
     * @access public
75
     *
76
     * @param string $orcid the ORCID to search for
77
     * @param RequestFactory $requestFactory a request object to inject
78
     *
79
     * @return void
80
     **/
81
    public function __construct(string $orcid, RequestFactory $requestFactory)
82
    {
83
        $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class);
84
        $this->orcid = $orcid;
85
        $this->requestFactory = $requestFactory;
86
    }
87
88
    /**
89
     * Sets API endpoint
90
     *
91
     * @access public
92
     *
93
     * @param string $endpoint the shortname of the endpoint
94
     *
95
     * @return void
96
     */
97
    public function setEndpoint(string $endpoint): void
98
    {
99
        $this->endpoint = $endpoint;
100
    }
101
102
    /**
103
     * Get the profile data
104
     *
105
     * @access public
106
     *
107
     * @return object|bool
108
     **/
109
    public function getData()
110
    {
111
        $url = $this->getApiEndpoint();
112
        try {
113
            $response = $this->requestFactory->request($url);
0 ignored issues
show
The method request() does not exist on Psr\Http\Message\RequestFactoryInterface. It seems like you code against a sub-type of Psr\Http\Message\RequestFactoryInterface such as TYPO3\CMS\Core\Http\RequestFactory. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

113
            /** @scrutinizer ignore-call */ 
114
            $response = $this->requestFactory->request($url);
Loading history...
114
        } catch (\Exception $e) {
115
            $this->logger->warning('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.');
116
            return false;
117
        }
118
        return $response->getBody()->getContents();
119
    }
120
121
    /**
122
     * Creates the qualified API endpoint for retrieving the desired data
123
     *
124
     * @access private
125
     *
126
     * @return string
127
     **/
128
    private function getApiEndpoint(): string
129
    {
130
        $url  = 'https://' . $this->level . '.' . self::HOSTNAME;
131
        $url .= '/v' . self::VERSION . '/';
132
        $url .= $this->orcid;
133
        $url .= '/' . $this->endpoint;
134
        return $url;
135
    }
136
}
137