Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 19 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| CheckUserFormatter | |
0.00% |
0 / 19 |
|
0.00% |
0 / 3 |
20 | |
0.00% |
0 / 1 |
| getHistoryType | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| changeSeparator | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| format | |
0.00% |
0 / 17 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Flow\Formatter; |
| 4 | |
| 5 | use MediaWiki\Context\IContextSource; |
| 6 | |
| 7 | class CheckUserFormatter extends AbstractFormatter { |
| 8 | protected function getHistoryType() { |
| 9 | return 'checkuser'; |
| 10 | } |
| 11 | |
| 12 | /** |
| 13 | * @return string |
| 14 | */ |
| 15 | protected function changeSeparator() { |
| 16 | return ' . . '; |
| 17 | } |
| 18 | |
| 19 | /** |
| 20 | * Create an array of links to be used when formatting the row in checkuser |
| 21 | * |
| 22 | * @param FormatterRow $row Row of data provided by the check user special page |
| 23 | * @param IContextSource $ctx |
| 24 | * @return array|null |
| 25 | */ |
| 26 | public function format( FormatterRow $row, IContextSource $ctx ) { |
| 27 | // @todo: this currently only implements CU links |
| 28 | // we'll probably want to add a hook to CheckUser that lets us blank out |
| 29 | // the entire line for entries that !isAllowed( <this-revision>, 'checkuser' ) |
| 30 | // @todo: we probably want to get the action description (generated revision comment) |
| 31 | // into checkuser sooner or later as well. |
| 32 | |
| 33 | $links = $this->serializer->buildLinks( $row ); |
| 34 | $properties = $this->serializer->buildProperties( $row->workflow->getId(), $row->revision, $ctx ); |
| 35 | if ( $links === null ) { |
| 36 | wfDebugLog( 'Flow', __METHOD__ . ': No links were generated for revision ' . |
| 37 | $row->revision->getRevisionId()->getAlphadecimal() ); |
| 38 | return null; |
| 39 | } |
| 40 | |
| 41 | $data = [ |
| 42 | 'links' => [ |
| 43 | $this->getDiffAnchor( $links, $ctx ), |
| 44 | $this->getHistAnchor( $links, $ctx ), |
| 45 | ], |
| 46 | 'properties' => $properties |
| 47 | ]; |
| 48 | |
| 49 | return [ |
| 50 | 'links' => $this->formatAnchorsAsPipeList( $data['links'], $ctx ), |
| 51 | 'title' => $this->changeSeparator() . $this->getTitleLink( $data, $row, $ctx ), |
| 52 | ]; |
| 53 | } |
| 54 | } |