Merge "Add .pipeline/ with dev image variant"
[lhc/web/wiklou.git] / includes / diff / UnsupportedSlotDiffRenderer.php
1 <?php
2 /**
3 * Renders a slot diff by doing a text diff on the native representation.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 * @file
21 * @ingroup DifferenceEngine
22 */
23
24 /**
25 * Produces a warning message about not being able to render a slot diff.
26 *
27 * @since 1.34
28 *
29 * @ingroup DifferenceEngine
30 */
31 class UnsupportedSlotDiffRenderer extends SlotDiffRenderer {
32
33 /**
34 * @var MessageLocalizer
35 */
36 private $localizer;
37
38 /**
39 * UnsupportedSlotDiffRenderer constructor.
40 *
41 * @param MessageLocalizer $localizer
42 */
43 public function __construct( MessageLocalizer $localizer ) {
44 $this->localizer = $localizer;
45 }
46
47 /** @inheritDoc */
48 public function getDiff( Content $oldContent = null, Content $newContent = null ) {
49 $this->normalizeContents( $oldContent, $newContent );
50
51 $oldModel = $oldContent->getModel();
52 $newModel = $newContent->getModel();
53
54 if ( $oldModel !== $newModel ) {
55 $msg = $this->localizer->msg( 'unsupported-content-diff2', $oldModel, $newModel );
56 } else {
57 $msg = $this->localizer->msg( 'unsupported-content-diff', $oldModel );
58 }
59
60 return Html::rawElement(
61 'tr',
62 [],
63 Html::rawElement(
64 'td',
65 [ 'colspan' => 4, 'class' => 'error' ],
66 $msg->parse()
67 )
68 );
69 }
70
71 }