PluginProbe
Depicter — Popup & Slider Builder / trunk
Depicter — Popup & Slider Builder vtrunk
4.8.1 trunk 1.0.0 1.1.0 1.1.2 1.1.4 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.5 1.3.8 1.5.0 1.5.1 1.5.2 1.5.5 1.6.0 1.6.1 1.6.2 1.7.0 All 76 releases
depicter / vendor / symfony / console / Helper / TableCell.php

TableCell.php in Depicter — Popup & Slider Builder trunk, at vendor/symfony/console/Helper/TableCell.php

79 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\Console\Helper;
13
14 use Symfony\Component\Console\Exception\InvalidArgumentException;
15
16 /**
17 * @author Abdellatif Ait boudad <a.aitboudad@gmail.com>
18 */
19 class TableCell
20 {
21 private $value;
22 private $options = [
23 'rowspan' => 1,
24 'colspan' => 1,
25 'style' => null,
26 ];
27
28 public function __construct(string $value = '', array $options = [])
29 {
30 $this->value = $value;
31
32 // check option names
33 if ($diff = array_diff(array_keys($options), array_keys($this->options))) {
34 throw new InvalidArgumentException(sprintf('The TableCell does not support the following options: \'%s\'.', implode('\', \'', $diff)));
35 }
36
37 if (isset($options['style']) && !$options['style'] instanceof TableCellStyle) {
38 throw new InvalidArgumentException('The style option must be an instance of "TableCellStyle".');
39 }
40
41 $this->options = array_merge($this->options, $options);
42 }
43
44 /**
45 * Returns the cell value.
46 *
47 * @return string
48 */
49 public function __toString()
50 {
51 return $this->value;
52 }
53
54 /**
55 * Gets number of colspan.
56 *
57 * @return int
58 */
59 public function getColspan()
60 {
61 return (int) $this->options['colspan'];
62 }
63
64 /**
65 * Gets number of rowspan.
66 *
67 * @return int
68 */
69 public function getRowspan()
70 {
71 return (int) $this->options['rowspan'];
72 }
73
74 public function getStyle(): ?TableCellStyle
75 {
76 return $this->options['style'];
77 }
78 }
79