Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
CRAP | |
57.14% |
4 / 7 |
| EndPointFactory | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
6.97 | |
57.14% |
4 / 7 |
| make($endPointClass=null,$virtualhost=null) | |
0.00% |
0 / 1 |
4.59 | |
66.67% |
4 / 6 |
|||
| factory($virtualhost=null) | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
| <?php | |
| namespace BOTK\Core; | |
| use BOTK\Core\Models\HttpProblem; | |
| class EndPointFactory | |
| { | |
| /** | |
| * Create and Endpoint and setup auto virtualhost | |
| */ | |
| public static function make($endPointClass=null,$virtualhost=null) | |
| { | |
| $baseEndPointClassName = '\\BOTK\\Core\\EndPoint'; | |
| if (!$endPointClass) $endPointClass = $baseEndPointClassName; | |
| if($endPointClass!=$baseEndPointClassName | |
| && !is_subclass_of($endPointClass, $baseEndPointClassName)){ | |
| throw new HttpErrorException( HttpProblem::factory( | |
| 500, 'Unable to create endpoint', "$endPointClass is not and EndPoint class")); | |
| } | |
| return new $endPointClass($virtualhost); | |
| } | |
| public static function factory($virtualhost=null) | |
| { | |
| return new static($virtualhost); | |
| } | |
| } |