MediaWiki master
MediaTransformError.php
Go to the documentation of this file.
1<?php
10namespace MediaWiki\Media;
11
15
25 private $msg;
26
35 public function __construct( $msg, $width, $height, ...$args ) {
36 $this->msg = wfMessage( $msg )->params( $args );
37 $this->width = (int)$width;
38 $this->height = (int)$height;
39 $this->url = false;
40 $this->path = false;
41 }
42
44 public function toHtml( $options = [] ) {
45 return "<div class=\"MediaTransformError\" style=\"" .
46 "width: {$this->width}px; height: {$this->height}px; display:inline-block;\">" .
47 $this->getHtmlMsg() .
48 "</div>";
49 }
50
54 public function toText() {
55 return $this->msg->text();
56 }
57
61 public function getHtmlMsg() {
62 return $this->msg->escaped();
63 }
64
68 public function getMsg() {
69 return $this->msg;
70 }
71
73 public function isError() {
74 return true;
75 }
76
82 public function getHttpStatusCode() {
83 return 500;
84 }
85}
86
88class_alias( MediaTransformError::class, 'MediaTransformError' );
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Basic media transform error class.
toHtml( $options=[])
Fetch HTML for this transform output.alt : Alternate text or captiondesc-link : Boolean,...
__construct( $msg, $width, $height,... $args)
isError()
This will be overridden to return true in error classes.bool
Base class for the output of MediaHandler::doTransform() and File::transform().
The Message class deals with fetching and processing of interface message into a variety of formats.
Definition Message.php:144
Value object representing a message parameter with one of the types from {.