| Conditions | 3 |
| Paths | 3 |
| Total Lines | 16 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 30 | public function parsePageAsync( PageIdentifier $pageIdentifier ) { |
||
| 31 | $params = []; |
||
| 32 | if ( $pageIdentifier->getId() !== null ) { |
||
| 33 | $params['pageid'] = $pageIdentifier->getId(); |
||
| 34 | } elseif ( $pageIdentifier->getTitle() !== null ) { |
||
| 35 | $params['page'] = $pageIdentifier->getTitle()->getText(); |
||
| 36 | } else { |
||
| 37 | throw new \RuntimeException( 'No way to identify page' ); |
||
| 38 | } |
||
| 39 | |||
| 40 | $promise = $this->api->getRequestAsync( new SimpleRequest( 'parse', $params ) ); |
||
| 41 | |||
| 42 | return $promise->then( function ( $result ) { |
||
| 43 | return $result['parse']; |
||
| 44 | } ); |
||
| 45 | } |
||
| 46 | |||
| 48 |