Page MenuHomeWickedGov Phorge

UserEntity.php
No OneTemporary

Size
1004 B
Referenced Files
None
Subscribers
None

UserEntity.php

<?php
namespace MediaWiki\Extension\OAuth\Entity;
use League\OAuth2\Server\Entities\UserEntityInterface;
use MediaWiki\Exception\MWException;
use MediaWiki\Extension\OAuth\Backend\Utils;
use MediaWiki\User\User;
class UserEntity implements UserEntityInterface {
/**
* @var int
*/
private $identifier;
/**
* @param User $user
* @return UserEntity|null
*/
public static function newFromMWUser( User $user ) {
try {
$userId = Utils::getCentralIdFromLocalUser( $user );
if ( !$userId ) {
return null;
}
return new static( $userId );
} catch ( MWException ) {
return null;
}
}
/**
* @param int $identifier
*/
public function __construct( $identifier ) {
$this->identifier = $identifier;
}
/**
* Return the user's identifier.
*
* @return int
*/
public function getIdentifier() {
return $this->identifier;
}
/**
* @return User|false
*/
public function getMWUser() {
return Utils::getLocalUserFromCentralId( $this->identifier );
}
}

File Metadata

Mime Type
text/x-php
Expires
Sun, Nov 22, 07:44 (19 h, 49 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
f1/d5/faaccbde16efa851a785c3c8ca87
Default Alt Text
UserEntity.php (1004 B)

Event Timeline