3 declare(strict_types
=1);
6 * This file is part of the TYPO3 CMS project.
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.
12 * For the full copyright and license information, please read the
13 * LICENSE.txt file that was distributed with this source code.
15 * The TYPO3 project - inspiring people to share!
18 namespace TYPO3\CMS\Core\Imaging\ImageManipulation
;
35 public function __construct(string $id, string $title, float $value)
37 $this->id
= str_replace('.', '_', $id);
38 $this->title
= $title;
39 $this->value
= $value;
45 public function getId(): string
51 * @param array $config
53 * @throws \TYPO3\CMS\Core\Imaging\ImageManipulation\InvalidConfigurationException
55 public static function createMultipleFromConfiguration(array $config): array
59 foreach ($config as $id => $ratioConfig) {
62 $ratioConfig['title'],
63 (float)$ratioConfig['value']
66 } catch (\Throwable
$throwable) {
67 throw new InvalidConfigurationException(sprintf('Invalid type for ratio id given: %s', $throwable->getMessage()), 1486313971, $throwable);
76 public function asArray(): array
80 'title' => $this->title
,
81 'value' => $this->value
,
88 public function getRatioValue(): float
96 public function isFree(): bool
98 return $this->value
=== 0.0;