98% of 43OPs |
100% of 7Lines |
67% of 6Branches |
100% of 4Paths |
Method | OPs | OPs % | Lines | Line % | Branches | Branches % | Paths | Path % |
---|---|---|---|---|---|---|---|---|
mageekguy\atoum\php\extension::__construct() | 7 | 100% | 2 | 100% | 1 | 0% | 1 | 100% |
mageekguy\atoum\php\extension::isLoaded() | 11 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
mageekguy\atoum\php\extension::requireExtension() | 25 | 96% | 4 | 100% | 4 | 75% | 2 | 100% |
# | |
---|---|
1 |
<?php |
2 | |
3 |
namespace mageekguy\atoum\php; |
4 | |
5 |
class extension |
6 |
{ |
7 |
protected $name; |
8 | |
9 |
public function __construct($name)100% |
10 |
{ |
11 |
$this->name = $name; |
12 |
} |
13 | |
14 |
public function isLoaded()100% |
15 |
{ |
16 |
return extension_loaded($this->name); |
17 |
} |
18 | |
19 |
public function requireExtension()100% |
20 |
{ |
21 |
if ($this->isLoaded() === false) |
22 |
{ |
23 |
throw new exception('PHP extension \'' . $this->name . '\' is not loaded'); |
24 |
} |
25 | |
26 |
return $this; |
27 |
} |
28 |
} |