* Example config:
*
* $wgForeignFileRepos[] = [
- * 'class' => 'ForeignAPIRepo',
+ * 'class' => ForeignAPIRepo::class,
* 'name' => 'shared',
* 'apibase' => 'https://en.wikipedia.org/w/api.php',
* 'fetchDescription' => true, // Optional
'timestamp',
];
- protected $fileFactory = [ 'ForeignAPIFile', 'newFromTitle' ];
+ protected $fileFactory = [ ForeignAPIFile::class, 'newFromTitle' ];
/** @var int Check back with Commons after this expiry */
protected $apiThumbCacheExpiry = 86400; // 1 day (24*3600)
*
* @param Title $title
* @param string|bool $time
- * @return File
+ * @return File|false
*/
function newFile( $title, $time = false ) {
if ( $time ) {
* @param string $name
* @param int $width
* @param int $height
- * @param array $result Out parameter that will be changed by the function.
+ * @param array &$result
* @param string $otherParams
*
* @return bool
* @param string $url
* @param string $timeout
* @param array $options
- * @param integer|bool &$mtime Resulting Last-Modified UNIX timestamp if received
+ * @param int|bool &$mtime Resulting Last-Modified UNIX timestamp if received
* @return bool|string
*/
public static function httpGet(
}
$req = MWHttpRequest::factory( $url, $options, __METHOD__ );
- $req->setUserAgent( ForeignAPIRepo::getUserAgent() );
+ $req->setUserAgent( self::getUserAgent() );
$status = $req->execute();
if ( $status->isOK() ) {
$cache = ObjectCache::getMainWANInstance();
return $cache->getWithSetCallback(
- $this->getLocalCacheKey( get_class( $this ), $target, md5( $url ) ),
+ $this->getLocalCacheKey( static::class, $target, md5( $url ) ),
$cacheTTL,
function ( $curValue, &$ttl ) use ( $url, $cache ) {
$html = self::httpGet( $url, 'default', [], $mtime );
* @throws MWException
*/
function enumFiles( $callback ) {
- throw new MWException( 'enumFiles is not supported by ' . get_class( $this ) );
+ throw new MWException( 'enumFiles is not supported by ' . static::class );
}
/**
* @throws MWException
*/
protected function assertWritableRepo() {
- throw new MWException( get_class( $this ) . ': write operations are not supported.' );
+ throw new MWException( static::class . ': write operations are not supported.' );
}
}