Completed
Push — master ( 552173...c8702c )
by Tobias
12:00 queued 43s
created

Jumbotron::placeMe()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 14
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 20
ccs 14
cts 14
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 11
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * Contains the component class for rendering a jumbotron.
4
 *
5
 * @copyright (C) 2018, Tobias Oetterer, Paderborn University
6
 * @license       https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License, version 3 (or later)
7
 *
8
 * This file is part of the MediaWiki extension BootstrapComponents.
9
 * The BootstrapComponents extension is free software: you can redistribute it
10
 * and/or modify it under the terms of the GNU General Public License as published
11
 * by the Free Software Foundation, either version 3 of the License, or
12
 * (at your option) any later version.
13
 *
14
 * The BootstrapComponents extension is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU General Public License
20
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
21
 *
22
 * @file
23
 * @ingroup       BootstrapComponents
24
 * @author        Tobias Oetterer
25
 */
26
27
namespace BootstrapComponents\Components;
28
29
use BootstrapComponents\AbstractComponent;
30
use \Html;
31
32
/**
33
 * Class Jumbotron
34
 *
35
 * Class for component 'jumbotron'
36
 *
37
 * @see   https://github.com/oetterer/BootstrapComponents/blob/master/docs/components.md#Jumbotron
38
 * @since 1.0
39
 */
40
class Jumbotron extends AbstractComponent {
41
	/**
42
	 * @inheritdoc
43
	 *
44
	 * @param string $input
45
	 */
46 5
	public function placeMe( $input ) {
47 5
		list ( $class, $style ) = $this->processCss( 'jumbotron', [] );
48
		# @hack: the outer container is a workaround, to get all the necessary css if not inside a grid container
49
		# @fixme: used inside mw content, the width calculation for smaller screens is broken (as of Bootstrap 1.2.3)
50 5
		return Html::rawElement(
51 5
			'div',
52
			[
53 5
				'class' => 'container',
54 5
			],
55 5
			Html::rawElement(
56 5
				'div',
57
				[
58 5
					'class' => $this->arrayToString( $class, ' ' ),
59 5
					'style' => $this->arrayToString( $style, ';' ),
60 5
					'id'    => $this->getId(),
61 5
				],
62
				$input
63 5
			)
64 5
		);
65
	}
66
}