Conditions | 2 |
Paths | 2 |
Total Lines | 32 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
10 | public function __invoke(): ?Property |
||
11 | { |
||
12 | $node = new Crawler($this->definition); |
||
13 | |||
14 | $property = new Property(); |
||
15 | |||
16 | $property->name = $this->getText($node, '[property="rdfs:label"]'); |
||
17 | |||
18 | if (empty($property->name)) { |
||
19 | return null; |
||
20 | } |
||
21 | |||
22 | $property->description = $this->getText($node, '[property="rdfs:comment"]'); |
||
23 | |||
24 | $property->resource = $this->getAttribute($node, 'resource'); |
||
25 | |||
26 | $node |
||
27 | ->filter('[property="http://schema.org/domainIncludes"]') |
||
28 | ->each(function (Crawler $domain) use ($property) { |
||
29 | $property->addType($this->getText($domain)); |
||
30 | }); |
||
31 | |||
32 | $node |
||
33 | ->filter('[property="http://schema.org/rangeIncludes"]') |
||
34 | ->each(function (Crawler $range) use ($property) { |
||
35 | $property->addRanges( |
||
36 | $this->castRangesToTypes($this->getText($range)) |
||
37 | ); |
||
38 | }); |
||
39 | |||
40 | return $property; |
||
41 | } |
||
42 | |||
70 |