1: <?php
2:
3: /**
4: * Copyright 2015, Eduardo Trujillo
5: *
6: * For the full copyright and license information, please view the LICENSE
7: * file that was distributed with this source code.
8: *
9: * This file is part of the Nucleus package
10: */
11:
12: namespace Chromabits\Nucleus\View\Bootstrap;
13:
14: use Chromabits\Nucleus\Support\Arr;
15: use Chromabits\Nucleus\View\Node;
16:
17: /**
18: * Class Container.
19: *
20: * @author Eduardo Trujillo <ed@chromabits.com>
21: * @package Chromabits\Nucleus\View\Bootstrap
22: */
23: class Container extends Node
24: {
25: /**
26: * @var bool
27: */
28: protected $fluid;
29:
30: /**
31: * Construct an instance of a Container.
32: *
33: * @param array $attributes
34: * @param \string[] $content
35: * @param bool|false $fluid
36: */
37: public function __construct(
38: array $attributes,
39: $content,
40: $fluid = false
41: ) {
42: $this->fluid = $fluid;
43:
44: if (Arr::has($attributes, 'class')) {
45: $attributes['class'] = implode(' ', [
46: $this->fluid ? 'container-fluid' : 'container',
47: $attributes['class'],
48: ]);
49: } else {
50: $attributes['class'] = $this->fluid ?
51: 'container-fluid' : 'container';
52: }
53:
54: parent::__construct('div', $attributes, $content, false);
55: }
56: }
57: