Issues (2563)

app/Elements/CharacterSet.php (1 issue)

Labels
Severity
1
<?php
2
3
/**
4
 * webtrees: online genealogy
5
 * Copyright (C) 2025 webtrees development team
6
 * This program is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
 * GNU General Public License for more details.
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16
 */
17
18
declare(strict_types=1);
19
20
namespace Fisharebest\Webtrees\Elements;
21
22
use Fisharebest\Webtrees\Tree;
23
24
use function strtoupper;
25
26
/**
27
 * CHARACTER_SET := {Size=1:8}
28
 * [ ANSEL |UTF-8 | UNICODE | ASCII ]
29
 * A code value that represents the character set to be used to interpret this
30
 * data. Currently, the preferred character set is ANSEL, which includes ASCII
31
 * as a subset. UNICODE is not widely supported by most operating systems;
32
 * therefore, GEDCOM produced using the UNICODE character set will be limited
33
 * in its interchangeability for a while but should eventually provide the
34
 * international flexibility that is desired. See Chapter 3, starting on page
35
 * 77.
36
 * Note:The IBMPC character set is not allowed. This character set cannot be
37
 * interpreted properly without knowing which code page the sender was using.
38
 */
39
class CharacterSet extends AbstractElement
0 ignored issues
show
The type Fisharebest\Webtrees\Elements\AbstractElement was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
40
{
41
    /**
42
     * Convert a value to a canonical form.
43
     *
44
     * @param string $value
45
     *
46
     * @return string
47
     */
48
    public function canonical(string $value): string
49
    {
50
        return strtoupper(parent::canonical($value));
51
    }
52
53
    /**
54
     * Create a default value for this element.
55
     *
56
     * @param Tree $tree
57
     *
58
     * @return string
59
     */
60
    public function default(Tree $tree): string
61
    {
62
        return 'UTF-8';
63
    }
64
65
    /**
66
     * A list of controlled values for this element
67
     *
68
     * @return array<int|string,string>
69
     */
70
    public function values(): array
71
    {
72
        return [
73
            'UTF-8'   => 'UTF-8',
74
            'UNICODE' => 'UNICODE',
75
            'ANSEL'   => 'ANSEL',
76
            'ASCII'   => 'ASCII',
77
        ];
78
    }
79
}
80