Conditions | 3 |
Paths | 3 |
Total Lines | 18 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
34 | public function create(Session $session, $class) |
||
35 | { |
||
36 | if (!$this->exists($class)) { |
||
37 | throw new \InvalidArgumentException(sprintf( |
||
38 | 'The page class "%s" can not be resolved.', |
||
39 | $class |
||
40 | )); |
||
41 | } |
||
42 | |||
43 | $instance = new $class($session); |
||
44 | |||
45 | if (!$instance instanceof DocumentElement) { |
||
46 | throw new \InvalidArgumentException( |
||
47 | 'A page class must be an instance of Behat\Mink\Element\DocumentElement.' |
||
48 | ); |
||
49 | } |
||
50 | |||
51 | return $instance; |
||
52 | } |
||
54 |