Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Completed
Pull Request — master (#1182)
by Henrique
06:38
created

NotEmoji::validate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of Respect/Validation.
5
 *
6
 * (c) Alexandre Gomes Gaigalas <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the "LICENSE.md"
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Respect\Validation\Rules;
15
16
use function implode;
17
use function preg_match;
18
19
/**
20
 * Validates if the input does not contain an emoji.
21
 *
22
 * @author Mazen Touati <[email protected]>
23
 */
24
final class NotEmoji extends AbstractRule
25
{
26
    private const GROUPS = [
27
        '[\x{1F385}-\x{1F9E6}]',
28
        '[\x{1F331}-\x{1F9A2}]',
29
        '[\x{1F32D}-\x{1F9C2}]',
30
        '[\x{1F300}-\x{1F9F3}]',
31
        '[\x{1F004}-\x{1F9FF}]',
32
        '[\x{1F399}-\x{1F9FE}]',
33
        '[\x{1F170}-\x{1F6D0}]',
34
        '[\x{1F38C}-\x{1F6A9}]',
35
        '[\x{261D}]',
36
        '[\x{2620}]',
37
        '[\x{2639}-\x{263A}]',
38
        '[\x{26D1}]',
39
        '[\x{26F7}-\x{26F9}]',
40
        '[\x{270A}-\x{270D}]',
41
        '[\x{2763}-\x{2764}]',
42
        '[\x{2618}]',
43
        '[\x{2615}]',
44
        '[\x{231A}-\x{231B}]',
45
        '[\x{23F0}-\x{23F3}]',
46
        '[\x{2600}-\x{2604}]',
47
        '[\x{2614}]',
48
        '[\x{2668}]',
49
        '[\x{2693}]',
50
        '[\x{26A1}]',
51
        '[\x{26C4}-\x{26C5}]',
52
        '[\x{26C8}]',
53
        '[\x{26E9}-\x{26EA}]',
54
        '[\x{26F0}-\x{26F5}]',
55
        '[\x{26FA}]',
56
        '[\x{26FD}]',
57
        '[\x{2708}]',
58
        '[\x{2744}]',
59
        '[\x{2B50}]',
60
        '[\x{265F}-\x{2660}]',
61
        '[\x{2663}-\x{2666}]',
62
        '[\x{26BD}-\x{26BE}]',
63
        '[\x{26F3}]',
64
        '[\x{26F8}]',
65
        '[\x{2728}]',
66
        '[\x{2328}]',
67
        '[\x{260E}]',
68
        '[\x{2692}-\x{2699}]',
69
        '[\x{26B0}-\x{26B1}]',
70
        '[\x{26CF}]',
71
        '[\x{26D3}]',
72
        '[\x{2702}]',
73
        '[\x{2709}]',
74
        '[\x{270F}]',
75
        '[\x{2712}]',
76
        '[\x{00A9}]',
77
        '[\x{00AE}]',
78
        '[\x{203C}]',
79
        '[\x{2049}]',
80
        '[\x{2122}]',
81
        '[\x{2139}]',
82
        '[\x{2194}-\x{2199}]',
83
        '[\x{21A9}-\x{21AA}]',
84
        '[\x{23CF}]',
85
        '[\x{23EA}-\x{23EF}]',
86
        '[\x{23F8}-\x{23FA}]',
87
        '[\x{24C2}]',
88
        '[\x{25AA}-\x{25AB}]',
89
        '[\x{25B6}]',
90
        '[\x{25C0}]',
91
        '[\x{25FB}-\x{25FE}]',
92
        '[\x{2611}]',
93
        '[\x{2622}-\x{2623}]',
94
        '[\x{2626}]',
95
        '[\x{262A}]',
96
        '[\x{262E}-\x{262F}]',
97
        '[\x{2638}]',
98
        '[\x{2640}-\x{2642}]',
99
        '[\x{2648}-\x{2653}]',
100
        '[\x{267B}]',
101
        '[\x{267E}-\x{267F}]',
102
        '[\x{2695}]',
103
        '[\x{23E9}]',
104
        '[\x{269B}-\x{269C}]',
105
        '[\x{26A0}]',
106
        '[\x{26AA}-\x{26AB}]',
107
        '[\x{26CE}]',
108
        '[\x{26D4}]',
109
        '[\x{2705}]',
110
        '[\x{2714}-\x{2716}]',
111
        '[\x{271D}]',
112
        '[\x{2721}]',
113
        '[\x{2733}-\x{2734}]',
114
        '[\x{2747}]',
115
        '[\x{274C}-\x{274E}]',
116
        '[\x{2753}-\x{2757}]',
117
        '[\x{2795}-\x{2797}]',
118
        '[\x{27A1}]',
119
        '[\x{27B0}]',
120
        '[\x{27BF}]',
121
        '[\x{2934}-\x{2935}]',
122
        '[\x{2B05}-\x{2B07}]',
123
        '[\x{2B1B}-\x{2B1C}]',
124
        '[\x{2B55}]',
125
        '[\x{3030}]',
126
        '[\x{303D}]',
127
        '[\x{3297}-\x{3299}]',
128
        '[\x{1F1E6}-\x{1F1FF}]',
129
        '\x{0023}\x{20E3}',
130
        '\x{0023}\x{FE0F}\x{20E3}',
131
        '\x{002A}\x{20E3}',
132
        '\x{002A}\x{FE0F}\x{20E3}',
133
        '\x{0030}\x{20E3}',
134
        '\x{0030}\x{FE0F}\x{20E3}',
135
        '\x{0031}\x{20E3}',
136
        '\x{0031}\x{FE0F}\x{20E3}',
137
        '\x{0032}\x{20E3}',
138
        '\x{0032}\x{FE0F}\x{20E3}',
139
        '\x{0033}\x{20E3}',
140
        '\x{0033}\x{FE0F}\x{20E3}',
141
        '\x{0034}\x{20E3}',
142
        '\x{0034}\x{FE0F}\x{20E3}',
143
        '\x{0035}\x{20E3}',
144
        '\x{0035}\x{FE0F}\x{20E3}',
145
        '\x{0036}\x{20E3}',
146
        '\x{0036}\x{FE0F}\x{20E3}',
147
        '\x{0037}\x{20E3}',
148
        '\x{0037}\x{FE0F}\x{20E3}',
149
        '\x{0038}\x{20E3}',
150
        '\x{0038}\x{FE0F}\x{20E3}',
151
        '\x{0039}\x{20E3}',
152
        '\x{0039}\x{FE0F}\x{20E3}',
153
    ];
154
155
    /**
156
     * {@inheritdoc}
157
     */
158
    public function validate($input): bool
159
    {
160
        return 0 === preg_match('/'.implode('|', self::GROUPS).'/mu', $input);
161
    }
162
}
163