‪TYPO3CMS  ‪main
IconSize.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 enum IconSize: string
21 {
22  case DEFAULT = 'default';
23  case SMALL = 'small';
24  case MEDIUM = 'medium';
25  case LARGE = 'large';
26  case MEGA = 'mega';
30  case OVERLAY = 'overlay';
31 
35  public function getDimensions(): array
36  {
37  return match ($this) {
38  self::DEFAULT, self::SMALL, self::OVERLAY => [16, 16],
39  self::MEDIUM => [32, 32],
40  self::LARGE => [48, 48],
41  self::MEGA => [64, 64],
42  };
43  }
44 
49  public function triggerDeprecation(): void
50  {
51  $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
52  $caller = end($backtrace);
53  $callerLocation = sprintf('file %s, line %d', $caller['file'], $caller['line']);
54 
55  trigger_error(sprintf(
56  'The size argument was passed as string in %s, which is deprecated since TYPO3 v13. Consider passing %s::%s instead.',
57  $callerLocation,
58  __CLASS__,
59  $this->name
60  ), E_USER_DEPRECATED);
61  }
62 }
‪TYPO3\CMS\Core\Imaging
Definition: Dimension.php:16