Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
40.00% covered (danger)
40.00%
2 / 5
66.67% covered (warning)
66.67%
2 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
Triple
40.00% covered (danger)
40.00%
2 / 5
66.67% covered (warning)
66.67%
2 / 3
10.40
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 toNTriples
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 equals
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
12
1<?php
2
3declare(strict_types=1);
4
5namespace LambdaTwelve\OneRecord\Rdf;
6
7final 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}