‪TYPO3CMS  ‪main
ConfigurationService.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 
21 
34 {
35  public function ‪serialize(array $configuration): string
36  {
37  return ‪serialize($this->‪makeSerializable($configuration));
38  }
39 
43  protected function ‪makeSerializable(array $configuration): array
44  {
45  return array_map(function (mixed $value): mixed {
46  if (is_array($value)) {
47  return $this->‪makeSerializable($value);
48  }
49  if ($value instanceof ‪FileInterface) {
50  return $value->toArray();
51  }
52  return $value;
53  }, $configuration);
54  }
55 }
‪TYPO3\CMS\Core\Resource\FileInterface
Definition: FileInterface.php:26
‪TYPO3\CMS\Core\Resource\Service
Definition: ConfigurationService.php:18
‪TYPO3\CMS\Core\Resource\Service\ConfigurationService\makeSerializable
‪makeSerializable(array $configuration)
Definition: ConfigurationService.php:43
‪TYPO3\CMS\Core\Resource\Service\ConfigurationService\serialize
‪serialize(array $configuration)
Definition: ConfigurationService.php:35
‪TYPO3\CMS\Core\Resource\Service\ConfigurationService
Definition: ConfigurationService.php:34