Page MenuHomeWickedGov Phorge

UserEntity.php
No OneTemporary

Size
1008 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 $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
Sun, Nov 22, 16:22 (1 w, 2 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
a4/be/9b50cfb62337b8a70a00092a0249
Default Alt Text
UserEntity.php (1008 B)

Event Timeline