| Conditions | 3 |
| Paths | 3 |
| Total Lines | 16 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 43 | public function parsePageAsync( PageIdentifier $pageIdentifier ) { |
||
| 44 | $params = array(); |
||
| 45 | if( $pageIdentifier->getId() !== null ) { |
||
| 46 | $params['pageid'] = $pageIdentifier->getId(); |
||
| 47 | } elseif( $pageIdentifier->getTitle() !== null ) { |
||
| 48 | $params['page'] = $pageIdentifier->getTitle()->getText(); |
||
| 49 | } else { |
||
| 50 | throw new \RuntimeException( 'No way to identify page' ); |
||
| 51 | } |
||
| 52 | |||
| 53 | $promise = $this->api->getRequestAsync( new SimpleRequest( 'parse', $params ) ); |
||
| 54 | |||
| 55 | return $promise->then( function( $result ) { |
||
| 56 | return $result['parse']; |
||
| 57 | } ); |
||
| 58 | } |
||
| 59 | |||
| 61 |