Conditions | 1 |
Paths | 1 |
Total Lines | 31 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
36 | protected function setName(string $name) |
||
37 | { |
||
38 | $name = str_replace([ |
||
39 | '*', |
||
40 | '#', |
||
41 | '1st', |
||
42 | '2nd', |
||
43 | '3rd', |
||
44 | '&', |
||
45 | 'U.S.', |
||
46 | ], [ |
||
47 | 'asterisk', |
||
48 | 'hash', |
||
49 | 'first', |
||
50 | 'second', |
||
51 | 'third', |
||
52 | 'and', |
||
53 | 'US', |
||
54 | ], $name); |
||
55 | |||
56 | $name = strtr($name, [ |
||
57 | 'Š'=>'S', 'š'=>'s', 'Đ'=>'Dj', 'đ'=>'dj', 'Ž'=>'Z', 'ž'=>'z', 'Č'=>'C', 'č'=>'c', 'Ć'=>'C', 'ć'=>'c', 'À'=>'A', 'Á'=>'A', 'Â'=>'A', 'Ã'=>'A', 'Ä'=>'A', 'Å'=>'A', 'Æ'=>'A', 'Ç'=>'C', 'È'=>'E', 'É'=>'E', 'Ê'=>'E', 'Ë'=>'E', 'Ì'=>'I', 'Í'=>'I', 'Î'=>'I', 'Ï'=>'I', 'Ñ'=>'N', 'Ò'=>'O', 'Ó'=>'O', 'Ô'=>'O', 'Õ'=>'O', 'Ö'=>'O', 'Ø'=>'O', 'Ù'=>'U', 'Ú'=>'U', 'Û'=>'U', 'Ü'=>'U', 'Ý'=>'Y', 'Þ'=>'B', 'ß'=>'Ss', 'à'=>'a', 'á'=>'a', 'â'=>'a', 'ã'=>'a', 'ä'=>'a', 'å'=>'a', 'æ'=>'a', 'ç'=>'c', 'è'=>'e', 'é'=>'e', 'ê'=>'e', 'ë'=>'e', 'ì'=>'i', 'í'=>'i', 'î'=>'i', 'ï'=>'i', 'ð'=>'o', 'ñ'=>'n', 'ò'=>'o', 'ó'=>'o', 'ô'=>'o', 'õ'=>'o', 'ö'=>'o', 'ø'=>'o', 'ù'=>'u', 'ú'=>'u', 'û'=>'u', 'ý'=>'y', 'þ'=>'b', 'ÿ'=>'y', 'Ŕ'=>'R', 'ŕ'=>'r', |
||
58 | ]); |
||
59 | |||
60 | $name = preg_replace('/E[0-9]+\.[0-9] /', null, $name); |
||
61 | |||
62 | $this->name = $name; |
||
63 | $this->cleanName = mb_strtolower(preg_replace("/\s+/", ' ', preg_replace("/[^\w]+/", ' ', $this->name))); |
||
64 | $this->const = 'CHARACTER_'.mb_strtoupper(preg_replace("/\s+/", '', preg_replace('/(.)(?= [a-z0-9])/', '$1_', $this->cleanName))); |
||
65 | $this->method = lcfirst(preg_replace("/\s+/", '', ucwords($this->cleanName))); |
||
66 | } |
||
67 | |||
129 |