[TASK] Add spaces around '=' of 'strict_types=1'
[Packages/TYPO3.CMS.git] / typo3 / sysext / t3editor / Classes / Mode.php
1 <?php
2 declare(strict_types = 1);
3 namespace TYPO3\CMS\T3editor;
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
18 /**
19 * Represents a mode for CodeMirror
20 */
21 class Mode
22 {
23 /**
24 * @var string
25 */
26 protected $identifier = '';
27
28 /**
29 * @var string
30 */
31 protected $formatCode = '';
32
33 /**
34 * @var array
35 */
36 protected $fileExtensions = [];
37
38 /**
39 * @var bool
40 */
41 protected $isDefault = false;
42
43 /**
44 * @param string $identifier
45 */
46 public function __construct(string $identifier)
47 {
48 $this->identifier = $identifier;
49 }
50
51 /**
52 * @return string
53 */
54 public function getIdentifier(): string
55 {
56 return $this->identifier;
57 }
58
59 /**
60 * @return string
61 */
62 public function getFormatCode(): string
63 {
64 return $this->formatCode;
65 }
66
67 /**
68 * @param string $formatCode
69 * @return Mode
70 */
71 public function setFormatCode(string $formatCode): Mode
72 {
73 $this->formatCode = $formatCode;
74
75 return $this;
76 }
77
78 /**
79 * @param array $fileExtensions
80 * @return self
81 */
82 public function bindToFileExtensions(array $fileExtensions): Mode
83 {
84 $this->fileExtensions = $fileExtensions;
85
86 return $this;
87 }
88
89 /**
90 * @return array
91 */
92 public function getBoundFileExtensions(): array
93 {
94 return $this->fileExtensions;
95 }
96
97 /**
98 * @return Mode
99 */
100 public function setAsDefault(): Mode
101 {
102 $this->isDefault = true;
103
104 return $this;
105 }
106
107 /**
108 * @return bool
109 */
110 public function isDefault(): bool
111 {
112 return $this->isDefault;
113 }
114 }