Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
40.00% |
2 / 5 |
|
66.67% |
2 / 3 |
CRAP | |
0.00% |
0 / 1 |
| Triple | |
40.00% |
2 / 5 |
|
66.67% |
2 / 3 |
10.40 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| toNTriples | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| equals | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
12 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace LambdaTwelve\OneRecord\Rdf; |
| 6 | |
| 7 | final readonly class Triple |
| 8 | { |
| 9 | public function __construct( |
| 10 | public Iri|BlankNode $subject, |
| 11 | public Iri $predicate, |
| 12 | public Term $object, |
| 13 | ) {} |
| 14 | |
| 15 | public function toNTriples(): string |
| 16 | { |
| 17 | return $this->subject->toNTriples() . ' ' . $this->predicate->toNTriples() . ' ' . $this->object->toNTriples() . ' .'; |
| 18 | } |
| 19 | |
| 20 | public function equals(self $other): bool |
| 21 | { |
| 22 | return $this->subject->equals($other->subject) |
| 23 | && $this->predicate->equals($other->predicate) |
| 24 | && $this->object->equals($other->object); |
| 25 | } |
| 26 | } |