@@ 19-39 (lines=21) @@ | ||
16 | * |
|
17 | * @author Matthieu Moquet <[email protected]> |
|
18 | */ |
|
19 | class SnakeCase implements FormatInterface |
|
20 | { |
|
21 | /** |
|
22 | * {@inheritdoc} |
|
23 | */ |
|
24 | public function split($word) |
|
25 | { |
|
26 | return explode('_', $word); |
|
27 | } |
|
28 | ||
29 | /** |
|
30 | * {@inheritdoc} |
|
31 | */ |
|
32 | public function join(array $words) |
|
33 | { |
|
34 | // Ensure words are lowercase |
|
35 | $words = array_map('strtolower', $words); |
|
36 | ||
37 | return implode('_', $words); |
|
38 | } |
|
39 | } |
|
40 |
@@ 19-39 (lines=21) @@ | ||
16 | * |
|
17 | * @author Denis Roussel <[email protected]> |
|
18 | */ |
|
19 | class SpinalCase implements FormatInterface |
|
20 | { |
|
21 | /** |
|
22 | * {@inheritdoc} |
|
23 | */ |
|
24 | public function split($word) |
|
25 | { |
|
26 | return explode('-', $word); |
|
27 | } |
|
28 | ||
29 | /** |
|
30 | * {@inheritdoc} |
|
31 | */ |
|
32 | public function join(array $words) |
|
33 | { |
|
34 | // Ensure words are lowercase |
|
35 | $words = array_map('strtolower', $words); |
|
36 | ||
37 | return implode('-', $words); |
|
38 | } |
|
39 | } |
|
40 |