| @@ 73-89 (lines=17) @@ | ||
| 70 | * |
|
| 71 | * @return static |
|
| 72 | */ |
|
| 73 | public function toSingular($language = 'en') |
|
| 74 | { |
|
| 75 | if (!class_exists('\\ICanBoogie\\Inflector')) |
|
| 76 | { |
|
| 77 | throw new \RuntimeException |
|
| 78 | ( |
|
| 79 | "This method requires ICanBoogie\Inflector. ". |
|
| 80 | "Install with: composer require icanboogie/inflector" |
|
| 81 | ); |
|
| 82 | } |
|
| 83 | ||
| 84 | return $this->newSelf |
|
| 85 | ( |
|
| 86 | \ICanBoogie\Inflector::get($language) |
|
| 87 | ->singularize($this->scalarString) |
|
| 88 | ); |
|
| 89 | } |
|
| 90 | ||
| 91 | /** |
|
| 92 | * Returns the plural version of the word. |
|
| @@ 98-114 (lines=17) @@ | ||
| 95 | * |
|
| 96 | * @return static |
|
| 97 | */ |
|
| 98 | public function toPlural($language = 'en') |
|
| 99 | { |
|
| 100 | if (!class_exists('\\ICanBoogie\\Inflector')) |
|
| 101 | { |
|
| 102 | throw new \RuntimeException |
|
| 103 | ( |
|
| 104 | "This method requires ICanBoogie\Inflector. ". |
|
| 105 | "Install with: composer require icanboogie/inflector" |
|
| 106 | ); |
|
| 107 | } |
|
| 108 | ||
| 109 | return $this->newSelf |
|
| 110 | ( |
|
| 111 | \ICanBoogie\Inflector::get($language) |
|
| 112 | ->pluralize($this->scalarString) |
|
| 113 | ); |
|
| 114 | } |
|
| 115 | ||
| 116 | /** |
|
| 117 | * Returns an ASCII version of the string. |
|