‪TYPO3CMS  10.4
Dimension.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
22 {
26  protected ‪$width;
27 
31  protected ‪$height;
32 
40  public function ‪__construct($size = ‪Icon::SIZE_DEFAULT)
41  {
42  switch ($size) {
44  $sizeInPixel = 48;
45  break;
47  $sizeInPixel = 32;
48  break;
51  $sizeInPixel = 16;
52  break;
53  default:
54  throw new \InvalidArgumentException('The given size ' . $size . ' is not a valid size, see Icon class for options', 1438871603);
55  }
56 
57  $this->width = (int)$sizeInPixel;
58  $this->height = (int)$sizeInPixel;
59  }
60 
65  public function ‪getWidth()
66  {
67  return ‪$this->width;
68  }
69 
74  public function ‪getHeight()
75  {
76  return ‪$this->height;
77  }
78 }
‪TYPO3\CMS\Core\Imaging\Icon\SIZE_SMALL
‪const SIZE_SMALL
Definition: Icon.php:30
‪TYPO3\CMS\Core\Imaging\Dimension\__construct
‪__construct($size=Icon::SIZE_DEFAULT)
Definition: Dimension.php:38
‪TYPO3\CMS\Core\Imaging
Definition: Dimension.php:16
‪TYPO3\CMS\Core\Imaging\Icon\SIZE_DEFAULT
‪const SIZE_DEFAULT
Definition: Icon.php:35
‪TYPO3\CMS\Core\Imaging\Dimension\$width
‪int $width
Definition: Dimension.php:25
‪TYPO3\CMS\Core\Imaging\Dimension\getHeight
‪int getHeight()
Definition: Dimension.php:72
‪TYPO3\CMS\Core\Imaging\Icon\SIZE_OVERLAY
‪const SIZE_OVERLAY
Definition: Icon.php:46
‪TYPO3\CMS\Core\Imaging\Dimension\$height
‪int $height
Definition: Dimension.php:29
‪TYPO3\CMS\Core\Imaging\Dimension
Definition: Dimension.php:22
‪TYPO3\CMS\Core\Imaging\Dimension\getWidth
‪int getWidth()
Definition: Dimension.php:63
‪TYPO3\CMS\Core\Imaging\Icon\SIZE_LARGE
‪const SIZE_LARGE
Definition: Icon.php:40