| Total Complexity | 7 |
| Total Lines | 60 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | class Inflect implements InflectInterface |
||
| 14 | { |
||
| 15 | /** @var Singularizer */ |
||
| 16 | private $singularizer; |
||
| 17 | |||
| 18 | /** @var Pluralizer */ |
||
| 19 | private $pluralizer; |
||
| 20 | |||
| 21 | 4 | public function __construct(Singularizer $singularizer, Pluralizer $pluralizer) |
|
| 25 | 4 | } |
|
| 26 | |||
| 27 | /** |
||
| 28 | * {@inheritdoc} |
||
| 29 | */ |
||
| 30 | 3 | public function tableize(string $word) : string |
|
| 31 | { |
||
| 32 | 3 | return mb_strtolower(preg_replace('~(?<=\\w)([A-Z])~u', '_$1', $word)); |
|
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * {@inheritdoc} |
||
| 37 | */ |
||
| 38 | 11 | public function classify(string $word) : string |
|
| 39 | { |
||
| 40 | 11 | return str_replace([' ', '_', '-'], '', ucwords($word, ' _-')); |
|
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * {@inheritdoc} |
||
| 45 | */ |
||
| 46 | 5 | public function camelize(string $word) : string |
|
| 47 | { |
||
| 48 | 5 | return lcfirst($this->classify($word)); |
|
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * {@inheritdoc} |
||
| 53 | */ |
||
| 54 | 2 | public function ucwords(string $string, string $delimiters = " \n\t\r\0\x0B-") : string |
|
| 55 | { |
||
| 56 | 2 | return ucwords($string, $delimiters); |
|
| 57 | } |
||
| 58 | |||
| 59 | /** |
||
| 60 | * {@inheritdoc} |
||
| 61 | */ |
||
| 62 | 256 | public function pluralize(string $word) : string |
|
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * {@inheritdoc} |
||
| 69 | */ |
||
| 70 | 256 | public function singularize(string $word) : string |
|
| 73 | } |
||
| 74 | } |
||
| 75 |