@@ -30,17 +30,17 @@ discard block |
||
30 | 30 | */ |
31 | 31 | private $configModifiedTime = null; |
32 | 32 | |
33 | - public function __construct($config_name='/../config.ttl') |
|
33 | + public function __construct($config_name = '/../config.ttl') |
|
34 | 34 | { |
35 | 35 | $this->cache = new Cache(); |
36 | 36 | try { |
37 | - $this->filePath = realpath( dirname(__FILE__) . $config_name ); |
|
37 | + $this->filePath = realpath(dirname(__FILE__).$config_name); |
|
38 | 38 | if (!file_exists($this->filePath)) { |
39 | 39 | throw new Exception('config.ttl file is missing, please provide one.'); |
40 | 40 | } |
41 | 41 | $this->initializeConfig(); |
42 | 42 | } catch (Exception $e) { |
43 | - echo "Error: " . $e->getMessage(); |
|
43 | + echo "Error: ".$e->getMessage(); |
|
44 | 44 | return; |
45 | 45 | } |
46 | 46 | } |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | // use APC user cache to store parsed config.ttl configuration |
75 | 75 | if ($this->cache->isAvailable() && !is_null($this->configModifiedTime)) { |
76 | 76 | // @codeCoverageIgnoreStart |
77 | - $key = realpath($this->filePath) . ", " . $this->configModifiedTime; |
|
78 | - $nskey = "namespaces of " . $key; |
|
77 | + $key = realpath($this->filePath).", ".$this->configModifiedTime; |
|
78 | + $nskey = "namespaces of ".$key; |
|
79 | 79 | $this->graph = $this->cache->fetch($key); |
80 | 80 | $this->namespaces = $this->cache->fetch($nskey); |
81 | 81 | if ($this->graph && $this->namespaces) { // found in cache |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | $this->initializeNamespaces(); |
94 | 94 | } catch (Exception $e) { |
95 | - echo "Error: " . $e->getMessage(); |
|
95 | + echo "Error: ".$e->getMessage(); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * @param int inclusion depth (0 for root configuration) |
114 | 114 | * @throws \EasyRdf\Exception |
115 | 115 | */ |
116 | - private function parseConfig($location, $depth=0) { |
|
116 | + private function parseConfig($location, $depth = 0) { |
|
117 | 117 | if (str_starts_with($location, "http://") || str_starts_with($location, "https://")) { |
118 | 118 | $ch = curl_init($location); |
119 | 119 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | $graph = $parser->parseGraph($turtle, $location); |
138 | 138 | $namespaces = $parser->getNamespaces(); |
139 | 139 | } catch (Exception $e) { |
140 | - throw new Exception("Failed to parse $location: " . $e->getMessage()); |
|
140 | + throw new Exception("Failed to parse $location: ".$e->getMessage()); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | $configResource = $this->configResource($graph, $location); |
@@ -148,10 +148,10 @@ discard block |
||
148 | 148 | $this->resource = $configResource; |
149 | 149 | } else { |
150 | 150 | // Add triples to existing configuration |
151 | - foreach($graph->resources() as $resource) { |
|
151 | + foreach ($graph->resources() as $resource) { |
|
152 | 152 | $subject = $resource == $configResource ? $this->resource : $resource; |
153 | - foreach($graph->properties($resource) as $property) { |
|
154 | - foreach($resource->all($property) as $value) { |
|
153 | + foreach ($graph->properties($resource) as $property) { |
|
154 | + foreach ($resource->all($property) as $value) { |
|
155 | 155 | $this->graph->add($subject, $property, $value); |
156 | 156 | } |
157 | 157 | } |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | // only include up to four levels |
168 | 168 | if ($depth < 4) { |
169 | 169 | $includes = $this->graph->allResources($this->resource, "skosmos:includeConfig"); |
170 | - foreach($includes as $location) { |
|
171 | - $this->parseConfig($location->getUri(), $depth+1); |
|
170 | + foreach ($includes as $location) { |
|
171 | + $this->parseConfig($location->getUri(), $depth + 1); |
|
172 | 172 | } |
173 | 173 | } |
174 | 174 | } |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | public function getGlobalPlugins() |
389 | 389 | { |
390 | 390 | $globalPlugins = array(); |
391 | - $globalPluginsResource = $this->getResource()->getResource("skosmos:globalPlugins"); |
|
391 | + $globalPluginsResource = $this->getResource()->getResource("skosmos:globalPlugins"); |
|
392 | 392 | if ($globalPluginsResource) { |
393 | 393 | foreach ($globalPluginsResource as $resource) { |
394 | 394 | $globalPlugins[] = $resource->getValue(); |