Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
7 / 7 |
|
100.00% |
7 / 7 |
|
100.00% |
6 / 6 |
|
100.00% |
5 / 5 |
CRAP | |
100.00% |
1 / 1 |
| Author | |
100.00% |
7 / 7 |
|
100.00% |
7 / 7 |
|
100.00% |
6 / 6 |
|
100.00% |
5 / 5 |
6 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |||
| __destruct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| __toString | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| name | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| equals | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | namespace Fdsn\Webservices\Event\Structs; |
| 3 | |
| 4 | /** |
| 5 | * Data structure to handle Author |
| 6 | * |
| 7 | * @param string $name Name of author |
| 8 | */ |
| 9 | class Author { |
| 10 | private string $name; |
| 11 | |
| 12 | function __construct(string $name){ |
| 13 | |
| 14 | if( empty($name) ) |
| 15 | throw new \InvalidArgumentException("Author name invalid"); |
| 16 | |
| 17 | $this->name = $name; |
| 18 | } |
| 19 | |
| 20 | function __destruct(){ } |
| 21 | |
| 22 | function __toString(){ return sprintf("%s", $this->name); } |
| 23 | |
| 24 | /** |
| 25 | * Get Author name |
| 26 | * @return string Catalog name |
| 27 | */ |
| 28 | public function name():string { return $this->name;} |
| 29 | |
| 30 | /** |
| 31 | * Compare two objects |
| 32 | * @return bool true are equals, false otherwise |
| 33 | */ |
| 34 | public function equals(self $other):bool{ return $this->name == $other->name; } |
| 35 | } |