@@ -11,9 +11,9 @@ class File implements Source
1111 private static $ minHyphens = null ;
1212 private $ path = null ;
1313 private $ language = null ;
14- private $ loaded = false ;
14+ private $ loaded ;
1515 private $ patterns = null ;
16- private $ max_pattern_length = null ;
16+ private $ maxPatternLength = null ;
1717 private $ hyphenations = null ;
1818
1919 public function __construct ($ language , $ path )
@@ -38,7 +38,7 @@ public function setLanguage($language)
3838 public function getMinHyphens ()
3939 {
4040 if (!self ::$ minHyphens ) {
41- self ::$ minHyphens = json_decode (file_get_contents ("{ $ this ->path } /min.json " ), true );
41+ self ::$ minHyphens = json_decode (file_get_contents ("$ this ->path /min.json " ), true );
4242 }
4343
4444 return isset (self ::$ minHyphens [$ this ->language ]) ? self ::$ minHyphens [$ this ->language ] : null ;
@@ -48,18 +48,18 @@ private function loadLanguage()
4848 {
4949 if (!$ this ->loaded ) {
5050 $ this ->patterns = [];
51- $ this ->max_pattern_length = 0 ;
51+ $ this ->maxPatternLength = 0 ;
5252 $ this ->hyphenations = [];
5353
5454 // parser state
5555 $ command = false ;
5656 $ braces = false ;
5757
5858 // parse .tex file
59- foreach (file ("{ $ this ->path } /hyph- { $ this ->language } .tex " ) as $ line ) {
59+ foreach (file ("$ this ->path /hyph- $ this ->language .tex " ) as $ line ) {
6060 $ offset = 0 ;
61- $ strlen_line = mb_strlen ($ line );
62- while ($ offset < $ strlen_line ) {
61+ $ strlenLine = mb_strlen ($ line );
62+ while ($ offset < $ strlenLine ) {
6363 $ char = $ line [$ offset ];
6464
6565 // %comment
@@ -74,7 +74,7 @@ private function loadLanguage()
7474 continue ; // next token
7575 }
7676
77- // {
77+ // opening brace
7878 if ($ char === '{ ' ) {
7979 $ braces = true ;
8080 $ offset ++;
@@ -89,43 +89,43 @@ private function loadLanguage()
8989 $ numbers = '' ;
9090 $ pattern = '' ;
9191 $ strlen = 0 ;
92- $ expect_number = true ;
92+ $ expectNumber = true ;
9393 foreach (preg_split ('/(?<!^)(?!$)/u ' , $ m [0 ]) as $ char ) {
9494 if (is_numeric ($ char )) {
9595 $ numbers .= $ char ;
96- $ expect_number = false ;
96+ $ expectNumber = false ;
9797 } else {
98- if ($ expect_number ) {
98+ if ($ expectNumber ) {
9999 $ numbers .= '0 ' ;
100100 }
101101 $ pattern .= $ char ;
102102 $ strlen ++;
103- $ expect_number = true ;
103+ $ expectNumber = true ;
104104 }
105105 $ offset ++;
106106 }
107- if ($ expect_number ) {
107+ if ($ expectNumber ) {
108108 $ numbers .= '0 ' ;
109109 }
110110
111111 $ this ->patterns [$ pattern ] = $ numbers ;
112- if ($ strlen > $ this ->max_pattern_length ) {
113- $ this ->max_pattern_length = $ strlen ;
112+ if ($ strlen > $ this ->maxPatternLength ) {
113+ $ this ->maxPatternLength = $ strlen ;
114114 }
115115 }
116116 continue 3 ; // next token
117117
118118 case 'hyphenation ' :
119119 if (preg_match ('~^\S+~u ' , substr ($ line , $ offset ), $ m ) === 1 ) {
120- $ hyphenation = preg_replace ( ' ~\-~ ' , '' , $ m [0 ]);
120+ $ hyphenation = str_replace ( ' - ' , '' , $ m [0 ]);
121121 $ this ->hyphenations [$ hyphenation ] = $ m [0 ];
122122 $ offset += strlen ($ m [0 ]);
123123 }
124124 continue 3 ; // next token
125125 }
126126 }
127127
128- // }
128+ // closing brace
129129 if ($ char === '} ' ) {
130130 $ braces = false ;
131131 $ command = false ;
@@ -153,7 +153,7 @@ public function getMaxPattern()
153153 {
154154 $ this ->loadLanguage ();
155155
156- return $ this ->max_pattern_length ;
156+ return $ this ->maxPatternLength ;
157157 }
158158
159159 public function getPatterns ()
0 commit comments