Passed
Pull Request — master (#1201)
by
unknown
03:53
created

VocabularyConfig::setPluginParameters()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 17
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 12
nc 4
nop 1
dl 0
loc 17
rs 9.8666
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * VocabularyConfig provides access to the vocabulary configuration defined in config.ttl.
5
 */
6
class VocabularyConfig extends BaseConfig
7
{
8
    private $pluginRegister;
9
    private $pluginParameters = array();
10
    private $languageOrderCache = array();
11
12
    const DEFAULT_PROPERTY_ORDER = array("rdf:type", "dc:isReplacedBy",
13
    "skos:definition", "skos:broader", "isothes:broaderGeneric",
14
    "isothes:broaderPartitive", "isothes:broaderInstantial",
15
    "skos:narrower", "isothes:narrowerGeneric", "isothes:narrowerPartitive",
16
    "isothes:narrowerInstantial", "skos:related", "skos:altLabel",
17
    "skos:note", "skos:scopeNote", "skos:historyNote", "rdfs:comment",
18
    "dc11:source", "dc:source", "skosmos:memberOf", "skosmos:memberOfArray");
19
20
    const ISO25964_PROPERTY_ORDER = array("rdf:type", "dc:isReplacedBy",
21
    // ISO 25964 allows placing all text fields (inc. SN and DEF) together
22
    // so we will do that, except for HN, which is clearly administrative
23
    "skos:note", "skos:scopeNote", "skos:definition", "rdfs:comment",
24
    "dc11:source", "dc:source", "skos:altLabel", "skos:broader",
25
    "isothes:broaderGeneric", "isothes:broaderPartitive",
26
    "isothes:broaderInstantial", "skos:narrower", "isothes:narrowerGeneric",
27
    "isothes:narrowerPartitive", "isothes:narrowerInstantial",
28
    "skos:related", "skos:historyNote", "skosmos:memberOf",
29
    "skosmos:memberOfArray");
30
31
    public function __construct($resource, $globalPlugins=array())
32
    {
33
        $this->resource = $resource;
34
        $this->globalPlugins = $globalPlugins;
0 ignored issues
show
Bug Best Practice introduced by
The property globalPlugins does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
35
        $this->setParameterizedPlugins();
36
        $pluginArray = $this->getPluginArray();
37
        $this->pluginRegister = new PluginRegister($pluginArray);
38
    }
39
40
    /**
41
     * Get an ordered array of plugin names with order configured in skosmos:vocabularyPlugins
42
     * @return array of plugin names
43
     */
44
    public function getPluginArray() : array
45
    {
46
        $pluginArray = array();
47
48
        $vocabularyPlugins = $this->resource->getResource('skosmos:vocabularyPlugins');
49
        if ($vocabularyPlugins) {
0 ignored issues
show
introduced by
$vocabularyPlugins is of type EasyRdf\Resource, thus it always evaluated to true.
Loading history...
50
            foreach ($vocabularyPlugins as $plugin) {
51
                if ($plugin instanceof EasyRdf\Literal) {
52
                    $pluginName = $plugin->getValue();
53
                    array_push($pluginArray, $pluginName);
54
                }
55
                else {
56
                    array_push($pluginArray, $plugin->getLiteral('skosmos:usePlugin')->getValue());
57
                }
58
            }
59
        }
60
        $pluginArray = array_merge($pluginArray, $this->globalPlugins);
61
62
        $plugins = $this->resource->allLiterals('skosmos:usePlugin');
63
        if ($plugins) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $plugins of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using ! empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
64
            foreach ($plugins as $pluginlit) {
65
                $pluginName = $pluginlit->getValue();
66
                array_push($pluginArray, $pluginName);
67
            }
68
        }
69
70
        $pluginArray = array_values(array_unique(array_merge($pluginArray, array_keys($this->pluginParameters))));
71
72
        return $pluginArray;
73
    }
74
75
    /**
76
     * Sets array of parameterized plugins
77
     * @param Easyrdf\Resource $pluginResource
78
     * @return void
79
     */
80
    private function setParameterizedPlugins() : void
81
    {
82
        $this->pluginParameters = array();
83
84
        $vocabularyPlugins = $this->resource->getResource('skosmos:vocabularyPlugins');
85
        if ($vocabularyPlugins) {
0 ignored issues
show
introduced by
$vocabularyPlugins is of type EasyRdf\Resource, thus it always evaluated to true.
Loading history...
86
            // $vocabularyPlugins has all resources
87
            foreach ($vocabularyPlugins as $plugin) {
88
                if ($plugin instanceof EasyRdf\Resource) {
89
                    $this->setPluginParameters($plugin);
90
                }
91
            }
92
        }
93
        $pluginResources = $this->resource->allResources('skosmos:useParamPlugin');
94
        if ($pluginResources) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $pluginResources of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using ! empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
95
            foreach ($pluginResources as $pluginResource) {
96
                $this->setPluginParameters($pluginResource);
97
            }
98
        }
99
    }
100
101
    /**
102
     * Updates array of parameterized plugins adding parameter values
103
     * @param Easyrdf\Resource $pluginResource
104
     * @return void
105
     */
106
    private function setPluginParameters(Easyrdf\Resource $pluginResource) : void
107
    {
108
        $pluginName = $pluginResource->getLiteral('skosmos:usePlugin')->getValue();
109
        $this->pluginParameters[$pluginName] = array();
110
111
        $pluginParams = $pluginResource->allResources('skosmos:parameters');
112
        foreach ($pluginParams as $parameter) {
113
114
            $paramLiterals = $parameter->allLiterals('schema:value');
115
            foreach ($paramLiterals as $paramLiteral) {
116
                $paramName = $parameter->getLiteral('schema:propertyID')->getValue();
117
                $paramValue = $paramLiteral->getValue();
118
                $paramLang = $paramLiteral->getLang();
119
                if ($paramLang) {
120
                    $paramName .= '_' . $paramLang;
121
                }
122
                $this->pluginParameters[$pluginName][$paramName] = $paramValue;
123
            }
124
        }
125
    }
126
127
    /**
128
     * Get the SPARQL endpoint URL for this vocabulary
129
     *
130
     * @return string|null endpoint URL, or null if not set
131
     */
132
    public function getSparqlEndpoint()
133
    {
134
        $endpoint = $this->resource->get('void:sparqlEndpoint');
135
        if ($endpoint) {
136
            return $endpoint->getUri();
137
        }
138
        return null;
139
    }
140
141
    /**
142
     * Get the SPARQL graph URI for this vocabulary
143
     *
144
     * @return string|null graph URI, or null if not set
145
     */
146
    public function getSparqlGraph()
147
    {
148
        $graph = $this->resource->get('skosmos:sparqlGraph');
149
        if ($graph) {
150
            $graph = $graph->getUri();
151
        }
152
153
        return $graph;
154
    }
155
156
    /**
157
     * Get the SPARQL dialect for this vocabulary
158
     *
159
     * @return string|null dialect name
160
     */
161
    public function getSparqlDialect()
162
    {
163
        $dialect = $this->resource->get('skosmos:sparqlDialect');
164
        if ($dialect) {
165
            $dialect = $dialect->getValue();
166
        }
167
168
        return $dialect;
169
    }
170
171
    /**
172
     * Get the default language of this vocabulary
173
     * @return string default language, e.g. 'en'
174
     */
175
176
    public function getDefaultLanguage()
177
    {
178
        $deflang = $this->resource->getLiteral('skosmos:defaultLanguage');
179
        if ($deflang) {
0 ignored issues
show
introduced by
$deflang is of type EasyRdf\Literal, thus it always evaluated to true.
Loading history...
180
            return $deflang->getValue();
181
        }
182
183
        $langs = $this->getLanguages();
184
        $deflang = reset($langs); // picking the first one from the list with reset since the keys are not numeric
185
        if (sizeof($langs) > 1) {
186
            trigger_error("Default language for vocabulary '" . $this->getShortName() . "' unknown, choosing '$deflang'.", E_USER_WARNING);
187
        }
188
189
        return $deflang;
190
    }
191
192
    /**
193
     * Whether the alphabetical index is small enough to be shown all at once.
194
     * @return boolean true if all concepts can be shown at once.
195
     */
196
    public function getAlphabeticalFull()
197
    {
198
        return $this->getBoolean('skosmos:fullAlphabeticalIndex');
199
    }
200
201
    /**
202
     * Returns a short name for a vocabulary if configured. If that has not been set
203
     * using vocabId as a fallback.
204
     * @return string
205
     */
206
    public function getShortName()
207
    {
208
        $shortname = $this->getLiteral('skosmos:shortName');
209
        if ($shortname)
210
          return $shortname;
211
212
        // if no shortname exists fall back to the id
213
        return $this->getId();
214
    }
215
216
    /**
217
     * Get the vocabulary feedback e-mail address and return it.
218
     *
219
     * @return string e-mail address or null if not defined.
220
     */
221
    public function getFeedbackRecipient()
222
    {
223
        $email = $this->resource->get('skosmos:feedbackRecipient');
224
        return isset($email) ? $email->getValue() : null;
225
    }
226
227
    /**
228
     * Returns the human readable vocabulary title.
229
     * @return string the title of the vocabulary
230
     */
231
    public function getTitle($lang = null)
232
    {
233
        return $this->getLiteral('dc:title', false, $lang);
0 ignored issues
show
Bug introduced by
false of type false is incompatible with the type string expected by parameter $default of BaseConfig::getLiteral(). ( Ignorable by Annotation )

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

233
        return $this->getLiteral('dc:title', /** @scrutinizer ignore-type */ false, $lang);
Loading history...
234
    }
235
236
    /**
237
     * Returns a boolean value set in the config.ttl config.
238
     * @return boolean
239
     */
240
    public function sortByNotation()
241
    {
242
        return $this->getBoolean('skosmos:sortByNotation');
243
    }
244
245
    /**
246
     * Returns a boolean value set in the config.ttl config.
247
     * @return boolean
248
     */
249
    public function showChangeList()
250
    {
251
        return $this->getBoolean('skosmos:showChangeList');
252
    }
253
254
    /**
255
     * get the URLs from which the vocabulary data can be downloaded
256
     * @return array Array with MIME type as key, URL as value
257
     */
258
    public function getDataURLs()
259
    {
260
        $ret = array();
261
        $urls = $this->resource->allResources("void:dataDump");
262
        foreach ($urls as $url) {
263
            // first try dc:format and dc11:format
264
            $mimetypelit = $url->getLiteral('dc:format');
265
            if ($mimetypelit === null) {
266
                $mimetypelit = $url->getLiteral('dc11:format');
267
            }
268
269
            if ($mimetypelit !== null) {
270
                $mimetype = $mimetypelit->getValue();
271
            } else {
272
                $format = EasyRdf\Format::guessFormat(null, $url->getURI());
273
                if ($format === null) {
274
                    trigger_error("Could not guess format for <$url>.", E_USER_WARNING);
275
                    continue;
276
                }
277
                $mimetypes = array_keys($format->getMimeTypes());
278
                $mimetype = $mimetypes[0];
279
            }
280
281
            $langLit = $url->getLiteral('dc:language');
282
283
            if ($langLit != null) {
284
                //when the mimetype has language variants
285
                $dataUrlLang = $langLit->getValue();
286
287
                if (!isset($ret[$mimetype])) {
288
                  $arr = array();
289
                } else {
290
                  $arr = $ret[$mimetype];
291
                }
292
                $arr[$dataUrlLang] = $url->getURI();
293
                $ret[$mimetype] = $arr;
294
            } else {
295
                $ret[$mimetype] = $url->getURI();
296
            }
297
        }
298
        return $ret;
299
    }
300
301
    /**
302
     * Returns the main Concept Scheme URI of that Vocabulary,
303
     * or null if not set.
304
     * @return string concept scheme URI or null
305
     */
306
307
    public function getMainConceptSchemeURI()
308
    {
309
        $val = $this->resource->getResource("skosmos:mainConceptScheme");
310
        if ($val) {
0 ignored issues
show
introduced by
$val is of type EasyRdf\Resource, thus it always evaluated to true.
Loading history...
311
            return $val->getURI();
312
        }
313
314
        return null;
315
    }
316
317
    /**
318
     * Returns the class URI used for concept groups in this vocabulary,
319
     * or null if not set.
320
     * @return string group class URI or null
321
     */
322
323
    public function getGroupClassURI()
324
    {
325
        $val = $this->resource->getResource("skosmos:groupClass");
326
        if ($val) {
0 ignored issues
show
introduced by
$val is of type EasyRdf\Resource, thus it always evaluated to true.
Loading history...
327
            return $val->getURI();
328
        }
329
330
        return null;
331
    }
332
333
    /**
334
     * Returns the class URI used for thesaurus arrays in this vocabulary,
335
     * or null if not set.
336
     * @return string array class URI or null
337
     */
338
339
    public function getArrayClassURI()
340
    {
341
        $val = $this->resource->getResource("skosmos:arrayClass");
342
        if ($val) {
0 ignored issues
show
introduced by
$val is of type EasyRdf\Resource, thus it always evaluated to true.
Loading history...
343
            return $val->getURI();
344
        }
345
346
        return null;
347
    }
348
349
    /**
350
     * Returns custom properties displayed on the search page if configured.
351
     * @return array array class URI or null
352
     */
353
354
    public function getAdditionalSearchProperties()
355
    {
356
        $resources = $this->resource->allResources("skosmos:showPropertyInSearch");
357
        $ret = array();
358
        foreach ($resources as $res) {
359
            $prop = $res->getURI();
360
            if (EasyRdf\RdfNamespace::shorten($prop) !== null) // shortening property labels if possible
361
            {
362
                $prop = EasyRdf\RdfNamespace::shorten($prop);
363
            }
364
365
            $ret[] = $prop;
366
        }
367
        return $ret;
368
    }
369
370
    /**
371
     * Queries whether the property should be shown with all the label language variations.
372
     * @param string $property
373
     * @return boolean
374
     */
375
    public function hasMultiLingualProperty($property)
376
    {
377
        $resources = $this->resource->allResources("skosmos:hasMultiLingualProperty");
378
        foreach ($resources as $res) {
379
            $prop = $res->getURI();
380
            if (EasyRdf\RdfNamespace::shorten($prop) !== null) // shortening property labels if possible
381
            {
382
                $prop = EasyRdf\RdfNamespace::shorten($prop);
383
            }
384
385
            if ($prop === $property) {
386
                return true;
387
            }
388
389
        }
390
        return false;
391
    }
392
393
    /**
394
     * Returns a boolean value set in the config.ttl config.
395
     * @return boolean
396
     */
397
    public function getShowHierarchy()
398
    {
399
        return $this->getBoolean('skosmos:showTopConcepts');
400
    }
401
402
    /**
403
     * Returns a boolean value set in the config.ttl config.
404
     * @return boolean
405
     */
406
    public function showConceptSchemesInHierarchy()
407
    {
408
        return $this->getBoolean('skosmos:conceptSchemesInHierarchy');
409
    }
410
411
    /**
412
     * Returns a boolean value set in the config.ttl config.
413
     * @return boolean defaults to true if fetching hasn't been explicitly denied.
414
     */
415
    public function getExternalResourcesLoading()
416
    {
417
        return $this->getBoolean('skosmos:loadExternalResources', true);
418
    }
419
420
    /**
421
     * Returns a boolean value set in the config.ttl config.
422
     * @return boolean
423
     */
424
    public function getShowLangCodes()
425
    {
426
        return $this->getBoolean('skosmos:explicitLanguageTags');
427
    }
428
429
    /**
430
     * Returns a boolean value set in the config.ttl config.
431
     * @return boolean
432
     */
433
    public function searchByNotation()
434
    {
435
        return $this->getBoolean('skosmos:searchByNotation');
436
    }
437
438
    /**
439
     * Returns skosmos:marcSourcecode value set in config.ttl.
440
     * @return string marcsource name
441
     */
442
    public function getMarcSourceCode($lang = null)
443
    {
444
        return $this->getLiteral('skosmos:marcSourceCode', false, $lang);
0 ignored issues
show
Bug introduced by
false of type false is incompatible with the type string expected by parameter $default of BaseConfig::getLiteral(). ( Ignorable by Annotation )

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

444
        return $this->getLiteral('skosmos:marcSourceCode', /** @scrutinizer ignore-type */ false, $lang);
Loading history...
445
    }
446
447
    /**
448
     * Returns a boolean value set in the config.ttl config.
449
     * @return array array of concept class URIs (can be empty)
450
     */
451
    public function getIndexClasses()
452
    {
453
        return $this->getResources("skosmos:indexShowClass");
454
    }
455
456
    /**
457
     * Returns skosmos:externalProperty values set in the config.ttl config.
458
     * @return array array of external property URIs (can be empty)
459
     */
460
    public function getExtProperties()
461
    {
462
        return $this->getResources("skosmos:externalProperty");
463
    }
464
465
    /**
466
     * Get the languages supported by this vocabulary
467
     * @return array languages supported by this vocabulary (as language tag strings)
468
     */
469
    public function getLanguages()
470
    {
471
        $langs = $this->resource->allLiterals('skosmos:language');
472
        $ret = array();
473
        foreach ($langs as $lang) {
474
            $langlit = Punic\Language::getName($lang->getValue(), $this->getEnvLang());
475
            $ret[$langlit] = $lang->getValue();
476
        }
477
        ksort($ret);
478
479
        return $ret;
480
    }
481
482
    /**
483
     * Returns the plugin parameters
484
     * @return string plugin parameters or null
485
     */
486
    public function getPluginParameters() {
487
        return $this->pluginParameters;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->pluginParameters returns the type array which is incompatible with the documented return type string.
Loading history...
488
    }
489
490
    /**
491
     * Returns the vocabulary default sidebar view.
492
     * @return string name of the view
493
     */
494
    public function getDefaultSidebarView()
495
    {
496
        $defview = $this->resource->getLiteral('skosmos:defaultSidebarView');
497
        if ($defview) {
0 ignored issues
show
introduced by
$defview is of type EasyRdf\Literal, thus it always evaluated to true.
Loading history...
498
            $value = $defview->getValue();
499
            if ($value === 'groups' || $value === 'hierarchy') {
500
                return $value;
501
            }
502
503
        }
504
        if ($this->showAlphabeticalIndex() === false) {
505
            if ($this->getShowHierarchy()) {
506
                return 'hierarchy';
507
            } else if ($this->getGroupClassURI()) {
508
                return 'groups';
509
            }
510
        }
511
        return 'alphabetical'; // if not defined displaying the alphabetical index
512
    }
513
514
    /**
515
     * Extracts the vocabulary id string from the baseuri of the vocabulary.
516
     * @return string identifier eg. 'mesh'.
517
     */
518
    public function getId()
519
    {
520
        $uriparts = explode("#", $this->resource->getURI());
521
        if (count($uriparts) != 1)
522
        // hash namespace
523
        {
524
            return $uriparts[1];
525
        }
526
527
        // slash namespace
528
        $uriparts = explode("/", $this->resource->getURI());
529
530
        return $uriparts[count($uriparts) - 1];
531
    }
532
533
    public function getShowStatistics() {
534
        return $this->getBoolean('skosmos:showStatistics', true);
535
    }
536
537
    public function getPluginRegister()
538
    {
539
        return $this->pluginRegister;
540
    }
541
542
    /**
543
     * Returns the property/properties used for visualizing concept hierarchies.
544
     * @return array array class URI or null
545
     */
546
547
    public function getHierarchyProperty()
548
    {
549
        $resources = $this->resource->allResources("skosmos:hierarchyProperty");
550
        $ret = array();
551
        foreach ($resources as $res) {
552
            $prop = $res->getURI();
553
            if (EasyRdf\RdfNamespace::shorten($prop) !== null) // prefixing if possible
554
            {
555
                $prop = EasyRdf\RdfNamespace::shorten($prop);
556
            }
557
558
            $ret[] = $prop;
559
        }
560
        return empty($ret) ? array('skos:broader') : $ret;
561
    }
562
563
    /**
564
     * Returns a boolean value set in the config.ttl config.
565
     * @return boolean
566
     */
567
    public function showNotation()
568
    {
569
        return $this->getBoolean('skosmos:showNotation', true);
570
    }
571
572
    /**
573
     * Returns a boolean value set in the config.ttl config.
574
     * @return boolean
575
     */
576
    public function showAlphabeticalIndex()
577
    {
578
        return $this->getBoolean('skosmos:showAlphabeticalIndex', true);
579
    }
580
581
    /**
582
     * Returns the alphabetical list qualifier in this vocabulary,
583
     * or null if not set.
584
     * @return EasyRdf\Resource|null alphabetical list qualifier resource or null
585
     */
586
    public function getAlphabeticalListQualifier()
587
    {
588
        return $this->resource->getResource('skosmos:alphabeticalListQualifier');
589
    }
590
591
    /**
592
     * Returns a boolean value set in the config.ttl config.
593
     * @return boolean
594
     */
595
    public function getShowDeprecated()
596
    {
597
        return $this->getBoolean('skosmos:showDeprecated', false);
598
    }
599
600
    /**
601
     * Returns the vocabulary dc:type value(s) with their labels and uris, if set in the vocabulary configuration.
602
     * @return array of objects or an empty array
603
     */
604
    public function getTypes($lang = null)
605
    {
606
        $resources = $this->resource->allResources("dc:type");
607
        $ret = array();
608
        foreach ($resources as $res) {
609
            $prop = $res->getURI();
610
            $label = $res->label($lang) ? $res->label($lang) : $res->label($this->getDefaultLanguage());
611
            $ret[] = array('uri' => $prop, 'prefLabel' =>  $label->getValue());
612
        }
613
        return $ret;
614
    }
615
616
    /**
617
     * Returns an array of fallback languages that is ordered by priority and
618
     * defined in the vocabulary configuration as a collection.
619
     * Additionally, the chosen content language is inserted with the highest priority
620
     * and the vocab default language is inserted with the lowest priority.
621
     * @param string $clang
622
     * @return array of language code strings
623
     */
624
    public function getLanguageOrder($clang)
625
    {
626
        if (array_key_exists($clang, $this->languageOrderCache)) {
627
            return $this->languageOrderCache[$clang];
628
        }
629
        $ret = array($clang);
630
        $fallbacks = !empty($this->resource->get('skosmos:fallbackLanguages')) ? $this->resource->get('skosmos:fallbackLanguages') : array();
631
        foreach ($fallbacks as $lang) {
632
            if (!in_array($lang, $ret)) {
633
                $ret[] = (string)$lang; // Literal to string conversion
634
            }
635
        }
636
        if (!in_array($this->getDefaultLanguage(), $ret)) {
637
            $ret[] = (string)$this->getDefaultLanguage();
638
        }
639
        foreach ($this->getLanguages() as $lang) {
640
            if (!in_array($lang, $ret)) {
641
                $ret[] = $lang;
642
            }
643
        }
644
        // store in cache so this doesn't have to be computed again
645
        $this->languageOrderCache[$clang] = $ret;
646
        return $ret;
647
    }
648
649
    /**
650
     * @return boolean
651
     */
652
    public function isUseModifiedDate()
653
    {
654
        return $this->getBoolean('skosmos:useModifiedDate', false);
655
    }
656
657
    /**
658
     * @return array
659
     */
660
    public function getPropertyOrder()
661
    {
662
        $order = $this->getResource()->getResource('skosmos:propertyOrder');
663
        if ($order === null) {
664
            return self::DEFAULT_PROPERTY_ORDER;
665
        }
666
667
        $short = EasyRdf\RdfNamespace::shorten($order);
668
        if ($short == 'skosmos:iso25964PropertyOrder') {
669
            return self::ISO25964_PROPERTY_ORDER;
670
        } elseif ($short == 'skosmos:defaultPropertyOrder') {
671
            return self::DEFAULT_PROPERTY_ORDER;
672
        }
673
        
674
        // check for custom order definition
675
        $orderList = $order->getResource('rdf:value');
676
        if ($orderList !== null && $orderList instanceof EasyRdf\Collection) {
677
            $ret = array();
678
            foreach ($orderList as $prop) {
679
                $short = $prop->shorten();
0 ignored issues
show
Bug introduced by
The method shorten() does not exist on null. ( Ignorable by Annotation )

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

679
                /** @scrutinizer ignore-call */ 
680
                $short = $prop->shorten();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
680
                $ret[] = ($short !== null) ? $short : $prop->getURI();
681
            }
682
            return $ret;
683
        }
684
        
685
        trigger_error("Property order for vocabulary '{$this->getShortName()}' unknown, using default order", E_USER_WARNING);
686
        return self::DEFAULT_PROPERTY_ORDER;
687
    }
688
}
689