LinkedDataResource   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 10
c 0
b 0
f 0
dl 0
loc 15
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A resolve() 0 13 2
1
<?php
2
3
class LinkedDataResource extends RemoteResource
4
{
5
    public function resolve(int $timeout): ?EasyRdf\Resource
6
    {
7
        try {
8
            // change the timeout setting for external requests
9
            $httpclient = EasyRdf\Http::getDefaultHttpClient();
10
            $httpclient->setConfig(array('timeout' => $timeout, 'useragent' => 'Skosmos'));
11
            EasyRdf\Http::setDefaultHttpClient($httpclient);
12
13
            $graph = EasyRdf\Graph::newAndLoad(EasyRdf\Utils::removeFragmentFromUri($this->uri));
14
            return $graph->resource($this->uri);
15
        } catch (Exception $e) {
16
            $this->model->getLogger()->info("LD resolution failed for <{$this->uri}>: $e");
17
            return null;
18
        }
19
20
    }
21
22
}
23