MediaWiki REL1_34
ApiBlockInfoTrait.php
Go to the documentation of this file.
1<?php
23
27trait ApiBlockInfoTrait {
28
41 private function getBlockDetails( AbstractBlock $block ) {
42 $vals = [];
43 $vals['blockid'] = $block->getId();
44 $vals['blockedby'] = $block->getByName();
45 $vals['blockedbyid'] = $block->getBy();
46 $vals['blockreason'] = $block->getReason();
47 $vals['blockedtimestamp'] = wfTimestamp( TS_ISO_8601, $block->getTimestamp() );
48 $vals['blockexpiry'] = ApiResult::formatExpiry( $block->getExpiry(), 'infinite' );
49 $vals['blockpartial'] = !$block->isSitewide();
50 if ( $block instanceof SystemBlock ) {
51 $vals['systemblocktype'] = $block->getSystemBlockType();
52 }
53 return $vals;
54 }
55
56}
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
static formatExpiry( $expiry, $infinity='infinity')
Format an expiry timestamp for API output.
getBy()
Get the user id of the blocking sysop.
getByName()
Get the username of the blocking sysop.
getTimestamp()
Get the timestamp indicating when the block was created.
getReason()
Get the reason given for creating the block.
isSitewide( $x=null)
Indicates that the block is a sitewide block.
getExpiry()
Get the block expiry time.
System blocks are temporary blocks that are created on enforcement (e.g.