Page MenuHomeWickedGov Phorge

UserEntity.php
No OneTemporary

Size
988 B
Referenced Files
None
Subscribers
None

UserEntity.php

<?php
namespace MediaWiki\Extension\OAuth\Entity;
use League\OAuth2\Server\Entities\UserEntityInterface;
use MediaWiki\Extension\OAuth\Backend\Utils;
use MediaWiki\User\User;
use MWException;
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 $ex ) {
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
Tue, Aug 18, 22:04 (1 d, 9 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
8a/2b/1c997dd68c27ae857d262330b563
Default Alt Text
UserEntity.php (988 B)

Event Timeline