Skip to content

Commit f38da66

Browse files
committed
new constants + documentation and testing
1 parent 8d4d62f commit f38da66

4 files changed

Lines changed: 40 additions & 21 deletions

File tree

README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,3 @@ require_once '/usr/share/php/Com/Tecnick/Unicode/Data/autoload.php';
100100

101101
Contributions are welcome. Please review [CONTRIBUTING.md](CONTRIBUTING.md), [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md), and [SECURITY.md](SECURITY.md).
102102

103-
---
104-
105-
## Contact
106-
107-
Nicola Asuni - <info@tecnick.com>

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.1.0
1+
2.2.0

src/Constant.php

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ class Constant
4545
* (U+202A) LEFT-TO-RIGHT EMBEDDING
4646
* Treat the following text as embedded left-to-right
4747
*/
48-
public const LRE = 8234;
48+
public const LRE = 0x202A;
4949

5050
/**
5151
* (U+202B) RIGHT-TO-LEFT EMBEDDING
5252
* Treat the following text as embedded right-to-left
5353
*/
54-
public const RLE = 8235;
54+
public const RLE = 0x202B;
5555

5656
/*
5757
* Explicit Directional Overrides
@@ -66,13 +66,13 @@ class Constant
6666
* (U+202D) for LEFT-TO-RIGHT OVERRIDE
6767
* Force following characters to be treated as strong left-to-right characters
6868
*/
69-
public const LRO = 8237;
69+
public const LRO = 0x202D;
7070

7171
/**
7272
* (U+202E) RIGHT-TO-LEFT OVERRIDE
7373
* Force following characters to be treated as strong right-to-left characters
7474
*/
75-
public const RLO = 8238;
75+
public const RLO = 0x202E;
7676

7777
/*
7878
* Terminating Explicit Directional Embeddings and Overrides
@@ -83,7 +83,7 @@ class Constant
8383
* (U+202C) POP DIRECTIONAL FORMATTING
8484
* End the scope of the last LRE, RLE, RLO, or LRO whose scope has not yet been terminated
8585
*/
86-
public const PDF = 8236;
86+
public const PDF = 0x202C;
8787

8888
/*
8989
* Explicit Directional Isolates
@@ -106,20 +106,20 @@ class Constant
106106
* (U+2066) LEFT-TO-RIGHT ISOLATE
107107
* Treat the following text as isolated and left-to-right
108108
*/
109-
public const LRI = 8294;
109+
public const LRI = 0x2066;
110110

111111
/**
112112
* (U+2067) RIGHT-TO-LEFT ISOLATE
113113
* Treat the following text as isolated and right-to-left
114114
*/
115-
public const RLI = 8295;
115+
public const RLI = 0x2067;
116116

117117
/**
118118
* (U+2068) FIRST STRONG ISOLATE
119119
* Treat the following text as isolated and in the direction of its first
120120
* strong directional character that is not inside a nested isolate
121121
*/
122-
public const FSI = 8296;
122+
public const FSI = 0x2068;
123123

124124
/*
125125
* Terminating Explicit Directional Isolates
@@ -133,7 +133,7 @@ class Constant
133133
* (U+2069) POP DIRECTIONAL ISOLATE
134134
* End the scope of the last LRI, RLI, or FSI
135135
*/
136-
public const PDI = 8297;
136+
public const PDI = 0x2069;
137137

138138
/*
139139
* Implicit Directional Marks
@@ -147,19 +147,19 @@ class Constant
147147
* (U+200E) LEFT-TO-RIGHT MARK
148148
* Left-to-right zero-width character
149149
*/
150-
public const LRM = 8206;
150+
public const LRM = 0x200E;
151151

152152
/**
153153
* (U+200F) RIGHT-TO-LEFT MARK
154154
* Right-to-left zero-width non-Arabic character
155155
*/
156-
public const RLM = 8207;
156+
public const RLM = 0x200F;
157157

158158
/**
159159
* (U+061C) ARABIC LETTER MARK
160160
* Right-to-left zero-width Arabic character
161161
*/
162-
public const ALM = 1564;
162+
public const ALM = 0x061C;
163163

164164
/*
165165
* Other useful characters
@@ -169,10 +169,34 @@ class Constant
169169
/**
170170
* (U+0020) SPACE
171171
*/
172-
public const SPACE = 32;
172+
public const SPACE = 0x20;
173+
174+
/**
175+
* (U+00A0) NO-BREAK SPACE
176+
* Type: CS (Common Separator)
177+
*/
178+
public const NO_BREAK_SPACE = 0x00A0;
173179

174180
/**
175181
* (U+200C) ZERO WIDTH NON-JOINER
176182
*/
177-
public const ZERO_WIDTH_NON_JOINER = 8204;
183+
public const ZERO_WIDTH_NON_JOINER = 0x200C;
184+
185+
/**
186+
* (U+200B) ZERO WIDTH SPACE
187+
* Type: BN (Boundary Neutral)
188+
*/
189+
public const ZERO_WIDTH_SPACE = 0x200B;
190+
191+
/**
192+
* (U+002D) HYPHEN-MINUS
193+
* Type: ES (European Number Separator)
194+
*/
195+
public const HYPHEN = 0x002D;
196+
197+
/**
198+
* (U+00AD) SOFT HYPHEN
199+
* Type: BN (Boundary Neutral)
200+
*/
201+
public const SOFT_HYPHEN = 0x00AD;
178202
}

test/ConstantTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ class ConstantTest extends TestCase
3434
public function testConstants(): void
3535
{
3636
$reflectionClass = new \ReflectionClass('\\' . \Com\Tecnick\Unicode\Data\Constant::class);
37-
$this->assertEquals(14, \count($reflectionClass->getConstants()));
37+
$this->assertEquals(18, \count($reflectionClass->getConstants()));
3838
}
3939
}

0 commit comments

Comments
 (0)