Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
80.00% covered (warning)
80.00%
4 / 5
80.00% covered (warning)
80.00%
4 / 5
CRAP
0.00% covered (danger)
0.00%
0 / 1
Namespaces
80.00% covered (warning)
80.00%
4 / 5
80.00% covered (warning)
80.00%
4 / 5
5.20
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
 cargo
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 api
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 xsd
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 codeList
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace LambdaTwelve\OneRecord\Spec;
6
7/**
8 * The IRIs ONE Record is built from. Kept in one place so a typo cannot hide
9 * in a handler, and so the unversioned ontology IRIs (what server information
10 * advertises) stay distinct from the `#`-terminated term namespaces.
11 */
12final class Namespaces
13{
14    /** Term namespace of the cargo ontology, e.g. cargo:Piece. */
15    public const string CARGO = 'https://onerecord.iata.org/ns/cargo#';
16
17    /** Term namespace of the API ontology, e.g. api:Change. */
18    public const string API = 'https://onerecord.iata.org/ns/api#';
19
20    /** Base of every code list, e.g. .../MeasurementUnitCode#KGM. */
21    public const string CODE_LISTS = 'https://onerecord.iata.org/ns/code-lists/';
22
23    public const string XSD = 'http://www.w3.org/2001/XMLSchema#';
24
25    public const string RDF = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#';
26
27    /** Unversioned ontology IRI, for api:hasSupportedOntology. */
28    public const string CARGO_ONTOLOGY = 'https://onerecord.iata.org/ns/cargo';
29
30    public const string API_ONTOLOGY = 'https://onerecord.iata.org/ns/api';
31
32    public const string CODE_LISTS_ONTOLOGY = 'https://onerecord.iata.org/ns/code-lists';
33
34    /** Prefix the spec recommends for stable ids of embedded (non-logistics-object) nodes. */
35    public const string EMBEDDED = 'internal:';
36
37    /** Prefix of unresolved local references inside a graph being built. */
38    public const string LOCAL = 'local:';
39
40    private function __construct() {}
41
42    public static function cargo(string $term): string
43    {
44        return self::CARGO . $term;
45    }
46
47    public static function api(string $term): string
48    {
49        return self::API . $term;
50    }
51
52    public static function xsd(string $term): string
53    {
54        return self::XSD . $term;
55    }
56
57    public static function codeList(string $list, string $code): string
58    {
59        return self::CODE_LISTS . $list . '#' . $code;
60    }
61}