[!!!][TASK] Do not handle 'uploadsfolder' in ext_emconf anymore
[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 * @internal
21 */
22 class Mode
23 {
24 /**
25 * @var string
26 */
27 protected $identifier = '';
28
29 /**
30 * @var string
31 */
32 protected $formatCode = '';
33
34 /**
35 * @var array
36 */
37 protected $fileExtensions = [];
38
39 /**
40 * @var bool
41 */
42 protected $isDefault = false;
43
44 /**
45 * @param string $identifier
46 */
47 public function __construct(string $identifier)
48 {
49 $this->identifier = $identifier;
50 }
51
52 /**
53 * @return string
54 */
55 public function getIdentifier(): string
56 {
57 return $this->identifier;
58 }
59
60 /**
61 * @return string
62 */
63 public function getFormatCode(): string
64 {
65 return $this->formatCode;
66 }
67
68 /**
69 * @param string $formatCode
70 * @return Mode
71 */
72 public function setFormatCode(string $formatCode): Mode
73 {
74 $this->formatCode = $formatCode;
75
76 return $this;
77 }
78
79 /**
80 * @param array $fileExtensions
81 * @return self
82 */
83 public function bindToFileExtensions(array $fileExtensions): Mode
84 {
85 $this->fileExtensions = $fileExtensions;
86
87 return $this;
88 }
89
90 /**
91 * @return array
92 */
93 public function getBoundFileExtensions(): array
94 {
95 return $this->fileExtensions;
96 }
97
98 /**
99 * @return Mode
100 */
101 public function setAsDefault(): Mode
102 {
103 $this->isDefault = true;
104
105 return $this;
106 }
107
108 /**
109 * @return bool
110 */
111 public function isDefault(): bool
112 {
113 return $this->isDefault;
114 }
115 }