@@ -10,5 +10,5 @@ |
||
10 | 10 | |
11 | 11 | class Inflector { |
12 | 12 | |
13 | - use Inflector; |
|
13 | + use Inflector; |
|
14 | 14 | } |
@@ -10,10 +10,10 @@ |
||
10 | 10 | |
11 | 11 | class TableFieldUndefinedException extends Exception |
12 | 12 | { |
13 | - public static function create($unExpectedFields, $message) |
|
14 | - { |
|
15 | - $fields = implode(', ', $unExpectedFields); |
|
13 | + public static function create($unExpectedFields, $message) |
|
14 | + { |
|
15 | + $fields = implode(', ', $unExpectedFields); |
|
16 | 16 | |
17 | - return new static($fields.' '.$message); |
|
18 | - } |
|
17 | + return new static($fields.' '.$message); |
|
18 | + } |
|
19 | 19 | } |
@@ -10,8 +10,8 @@ |
||
10 | 10 | |
11 | 11 | class NullArgumentPassedToFunctionException extends Exception |
12 | 12 | { |
13 | - public static function create($message) |
|
14 | - { |
|
15 | - return new static ($message); |
|
16 | - } |
|
13 | + public static function create($message) |
|
14 | + { |
|
15 | + return new static ($message); |
|
16 | + } |
|
17 | 17 | } |
@@ -10,8 +10,8 @@ |
||
10 | 10 | |
11 | 11 | class NoRecordDeletionException extends Exception |
12 | 12 | { |
13 | - public static function create($message) |
|
14 | - { |
|
15 | - return new static($message); |
|
16 | - } |
|
13 | + public static function create($message) |
|
14 | + { |
|
15 | + return new static($message); |
|
16 | + } |
|
17 | 17 | } |
@@ -10,8 +10,8 @@ |
||
10 | 10 | |
11 | 11 | class NoRecordInsertionException extends Exception |
12 | 12 | { |
13 | - public static function create($mesaage) |
|
14 | - { |
|
15 | - return new static($mesaage); |
|
16 | - } |
|
13 | + public static function create($mesaage) |
|
14 | + { |
|
15 | + return new static($mesaage); |
|
16 | + } |
|
17 | 17 | } |
@@ -37,62 +37,62 @@ |
||
37 | 37 | |
38 | 38 | trait Inflector |
39 | 39 | { |
40 | - /** |
|
41 | - * Pluralizes English nouns. |
|
42 | - * |
|
43 | - * @static |
|
44 | - * |
|
45 | - * @param string $word English noun to pluralize |
|
46 | - * |
|
47 | - * @return string Plural noun |
|
48 | - */ |
|
49 | - public static function pluralize($word) |
|
50 | - { |
|
51 | - $plural = [ |
|
52 | - '/(quiz)$/i' => '$1zes', |
|
53 | - '/^(ox)$/i' => '$1en', |
|
54 | - '/([m|l])ouse$/i' => '$1ice', |
|
55 | - '/(matr|vert|ind)ix|ex$/i' => '$1ices', |
|
56 | - '/(x|ch|ss|sh)$/i' => '$1es', |
|
57 | - '/([^aeiouy]|qu)y$/i' => '$1ies', |
|
58 | - '/(hive)$/i' => '$1s', |
|
59 | - '/(?:([^f])fe|([lr])f)$/i' => '$1$2ves', |
|
60 | - '/(shea|lea|loa|thie)f$/i' => '$1ves', |
|
61 | - '/sis$/i' => 'ses', |
|
62 | - '/([ti])um$/i' => '$1a', |
|
63 | - '/(tomat|potat|ech|her|vet)o$/i' => '$1oes', |
|
64 | - '/(bu)s$/i' => '$1ses', |
|
65 | - '/(alias)$/i' => '$1es', |
|
66 | - '/(octop)us$/i' => '$1i', |
|
67 | - '/(ax|test)is$/i' => '$1es', |
|
68 | - '/(us)$/i' => '$1es', |
|
69 | - '/s$/i' => 's', |
|
70 | - '/$/' => 's', |
|
71 | - ]; |
|
72 | - $uncountable = ['equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep']; |
|
73 | - $irregular = [ |
|
74 | - 'person' => 'people', |
|
75 | - 'man' => 'men', |
|
76 | - 'child' => 'children', |
|
77 | - 'sex' => 'sexes', |
|
78 | - 'move' => 'moves', ]; |
|
79 | - $lowercased_word = strtolower($word); |
|
80 | - foreach ($uncountable as $_uncountable) { |
|
81 | - if (substr($lowercased_word, (-1 * strlen($_uncountable))) == $_uncountable) { |
|
82 | - return $word; |
|
83 | - } |
|
84 | - } |
|
85 | - foreach ($irregular as $_plural => $_singular) { |
|
86 | - if (preg_match('/('.$_plural.')$/i', $word, $arr)) { |
|
87 | - return preg_replace('/('.$_plural.')$/i', substr($arr[0], 0, 1).substr($_singular, 1), $word); |
|
88 | - } |
|
89 | - } |
|
90 | - foreach ($plural as $rule => $replacement) { |
|
91 | - if (preg_match($rule, $word)) { |
|
92 | - return preg_replace($rule, $replacement, $word); |
|
93 | - } |
|
94 | - } |
|
40 | + /** |
|
41 | + * Pluralizes English nouns. |
|
42 | + * |
|
43 | + * @static |
|
44 | + * |
|
45 | + * @param string $word English noun to pluralize |
|
46 | + * |
|
47 | + * @return string Plural noun |
|
48 | + */ |
|
49 | + public static function pluralize($word) |
|
50 | + { |
|
51 | + $plural = [ |
|
52 | + '/(quiz)$/i' => '$1zes', |
|
53 | + '/^(ox)$/i' => '$1en', |
|
54 | + '/([m|l])ouse$/i' => '$1ice', |
|
55 | + '/(matr|vert|ind)ix|ex$/i' => '$1ices', |
|
56 | + '/(x|ch|ss|sh)$/i' => '$1es', |
|
57 | + '/([^aeiouy]|qu)y$/i' => '$1ies', |
|
58 | + '/(hive)$/i' => '$1s', |
|
59 | + '/(?:([^f])fe|([lr])f)$/i' => '$1$2ves', |
|
60 | + '/(shea|lea|loa|thie)f$/i' => '$1ves', |
|
61 | + '/sis$/i' => 'ses', |
|
62 | + '/([ti])um$/i' => '$1a', |
|
63 | + '/(tomat|potat|ech|her|vet)o$/i' => '$1oes', |
|
64 | + '/(bu)s$/i' => '$1ses', |
|
65 | + '/(alias)$/i' => '$1es', |
|
66 | + '/(octop)us$/i' => '$1i', |
|
67 | + '/(ax|test)is$/i' => '$1es', |
|
68 | + '/(us)$/i' => '$1es', |
|
69 | + '/s$/i' => 's', |
|
70 | + '/$/' => 's', |
|
71 | + ]; |
|
72 | + $uncountable = ['equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep']; |
|
73 | + $irregular = [ |
|
74 | + 'person' => 'people', |
|
75 | + 'man' => 'men', |
|
76 | + 'child' => 'children', |
|
77 | + 'sex' => 'sexes', |
|
78 | + 'move' => 'moves', ]; |
|
79 | + $lowercased_word = strtolower($word); |
|
80 | + foreach ($uncountable as $_uncountable) { |
|
81 | + if (substr($lowercased_word, (-1 * strlen($_uncountable))) == $_uncountable) { |
|
82 | + return $word; |
|
83 | + } |
|
84 | + } |
|
85 | + foreach ($irregular as $_plural => $_singular) { |
|
86 | + if (preg_match('/('.$_plural.')$/i', $word, $arr)) { |
|
87 | + return preg_replace('/('.$_plural.')$/i', substr($arr[0], 0, 1).substr($_singular, 1), $word); |
|
88 | + } |
|
89 | + } |
|
90 | + foreach ($plural as $rule => $replacement) { |
|
91 | + if (preg_match($rule, $word)) { |
|
92 | + return preg_replace($rule, $replacement, $word); |
|
93 | + } |
|
94 | + } |
|
95 | 95 | |
96 | - return false; |
|
97 | - } |
|
96 | + return false; |
|
97 | + } |
|
98 | 98 | } |
@@ -10,8 +10,8 @@ |
||
10 | 10 | |
11 | 11 | class NoRecordDeletionException extends Exception |
12 | 12 | { |
13 | - public static function create($message) |
|
14 | - { |
|
15 | - return new static($message); |
|
16 | - } |
|
13 | + public static function create($message) |
|
14 | + { |
|
15 | + return new static($message); |
|
16 | + } |
|
17 | 17 | } |
@@ -10,8 +10,8 @@ |
||
10 | 10 | |
11 | 11 | class NoRecordDeletionException extends Exception |
12 | 12 | { |
13 | - public static function create($message) |
|
14 | - { |
|
15 | - return new static($message); |
|
16 | - } |
|
13 | + public static function create($message) |
|
14 | + { |
|
15 | + return new static($message); |
|
16 | + } |
|
17 | 17 | } |
@@ -10,8 +10,8 @@ |
||
10 | 10 | |
11 | 11 | class NoRecordDeletionException extends Exception |
12 | 12 | { |
13 | - public static function create($message) |
|
14 | - { |
|
15 | - return new static($message); |
|
16 | - } |
|
13 | + public static function create($message) |
|
14 | + { |
|
15 | + return new static($message); |
|
16 | + } |
|
17 | 17 | } |