Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
5 / 5
CRAP
100.00% covered (success)
100.00%
1 / 1
Id
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
5 / 5
6
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
2
 __toString
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 value
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 isValid
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 equals
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2namespace Fdsn\Webservices\Event\Structs;
3
4/**
5 * Data structure to handle Id value
6 *
7 * @param int $id fdsn quake id 
8 */
9class Id{
10    private int $value;
11
12    function __construct( int $value) {
13        if( ! $this->isValid($value) )
14            throw new \InvalidArgumentException("Id value invalid");
15
16        $this->value = $value;
17    }
18
19    /**
20     * Get id value as string
21     * @return string     Depth value in "%.2f km" format
22     */
23    function __toString(){ return sprintf("%d", $this->value); }
24
25    /**
26     * Get id value
27     * @return int     fdsn quake id
28     */
29    public function value():int{ return $this->value; }
30
31    /**
32     * Check if id value is valid
33     * @return bool     True if is valid, false otherwise
34     */
35    private function isValid(int $value):bool { return $value > 0; }
36
37    /**
38     * Compare two objects
39     * @return bool        true are equals, false otherwise
40     */
41    public function equals(self $other):bool{ return $this->value == $other->value; }
42} 

Paths

Below are the source code lines that represent each code path as identified by Xdebug. Please note a path is not necessarily coterminous with a line, a line may contain multiple paths and therefore show up more than once. Please also be aware that some paths may include implicit rather than explicit branches, e.g. an if statement always has an else as part of its logical flow even if you didn't write one.

Id->__construct
12    function __construct( int $value) {
13        if( ! $this->isValid($value) )
 
14            throw new \InvalidArgumentException("Id value invalid");
12    function __construct( int $value) {
13        if( ! $this->isValid($value) )
 
16        $this->value = $value;
17    }
Id->__toString
23    function __toString(){ return sprintf("%d", $this->value); }
Id->equals
41    public function equals(self $other):bool{ return $this->value == $other->value; }
Id->isValid
35    private function isValid(int $value):bool { return $value > 0; }
Id->value
29    public function value():int{ return $this->value; }