Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 20 |
|
0.00% |
0 / 6 |
CRAP | |
0.00% |
0 / 1 |
| ApiQueryCodexIcons | |
0.00% |
0 / 20 |
|
0.00% |
0 / 6 |
42 | |
0.00% |
0 / 1 |
| execute | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
| getCacheMode | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| shouldCheckMaxlag | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getAllowedParams | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
2 | |||
| getExamplesMessages | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| getHelpUrls | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Api; |
| 4 | |
| 5 | use MediaWiki\ResourceLoader\CodexModule; |
| 6 | use Wikimedia\ParamValidator\ParamValidator; |
| 7 | |
| 8 | class ApiQueryCodexIcons extends ApiQueryBase { |
| 9 | |
| 10 | public function execute() { |
| 11 | $params = $this->extractRequestParams(); |
| 12 | $iconNames = $params['names']; |
| 13 | |
| 14 | $icons = CodexModule::getIcons( null, $this->getConfig(), $iconNames ); |
| 15 | |
| 16 | $result = $this->getResult(); |
| 17 | $result->addValue( 'query', $this->getModuleName(), $icons ); |
| 18 | } |
| 19 | |
| 20 | /** @inheritDoc */ |
| 21 | public function getCacheMode( $params ) { |
| 22 | return 'public'; |
| 23 | } |
| 24 | |
| 25 | /** |
| 26 | * No database interaction, so maxlag check is irrelevant |
| 27 | * @return bool |
| 28 | */ |
| 29 | public function shouldCheckMaxlag() { |
| 30 | return false; |
| 31 | } |
| 32 | |
| 33 | /** @inheritDoc */ |
| 34 | public function getAllowedParams() { |
| 35 | return [ |
| 36 | 'names' => [ |
| 37 | ParamValidator::PARAM_TYPE => array_keys( CodexModule::getIcons( null, $this->getConfig() ) ), |
| 38 | ParamValidator::PARAM_REQUIRED => true, |
| 39 | ParamValidator::PARAM_ISMULTI => true, |
| 40 | ParamValidator::PARAM_ALL => true, |
| 41 | ] |
| 42 | ]; |
| 43 | } |
| 44 | |
| 45 | /** @inheritDoc */ |
| 46 | protected function getExamplesMessages() { |
| 47 | return [ |
| 48 | 'action=query&list=codexicons&names=cdxIconInfo|cdxIconTrash' => |
| 49 | 'apihelp-query+codexicons-example', |
| 50 | ]; |
| 51 | } |
| 52 | |
| 53 | /** @inheritDoc */ |
| 54 | public function getHelpUrls() { |
| 55 | return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:CodexIcons'; |
| 56 | } |
| 57 | } |