TYPO3  7.6
TableCell.php
Go to the documentation of this file.
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 
17 class TableCell
18 {
22  private $value;
23 
27  private $options = array(
28  'rowspan' => 1,
29  'colspan' => 1,
30  );
31 
36  public function __construct($value = '', array $options = array())
37  {
38  $this->value = $value;
39 
40  // check option names
41  if ($diff = array_diff(array_keys($options), array_keys($this->options))) {
42  throw new \InvalidArgumentException(sprintf('The TableCell does not support the following options: \'%s\'.', implode('\', \'', $diff)));
43  }
44 
45  $this->options = array_merge($this->options, $options);
46  }
47 
53  public function __toString()
54  {
55  return $this->value;
56  }
57 
63  public function getColspan()
64  {
65  return (int) $this->options['colspan'];
66  }
67 
73  public function getRowspan()
74  {
75  return (int) $this->options['rowspan'];
76  }
77 }