Source of file Pluralize.php
Size: 0,891 Bytes - Last Modified: 2015-12-22T09:12:14-05:00
../src/Filter/Pluralize.php
12345678910111213141516171819202122232425262728293031323334353637
Covered by 7 test(s):
38
Covered by 2 test(s):
3940
Covered by 5 test(s):
414243
| <?php /** * pluralize filter * * @category PHP * @package MvcLite * @subpackage Filter * @since File available since release 1.1.x * @author Cory Collier <corycollier@corycollier.com> */ namespace MvcLite\Filter; use MvcLite\FilterAbstract as FilterAbstract; /** * pluralize filter * * @category PHP * @package MvcLite * @subpackage Filter * @since Class available since release 1.1.x * @author Cory Collier <corycollier@corycollier.com> */ class Pluralize extends FilterAbstract { /** * filters a given string * * @param string $word * * @return string */ public function filter($word = '') { // if the word ends with the lettter 'y' if (substr($word, -1) == 'y') { return substr($word, 0, strlen($word) - 1) . 'ies'; } return "{$word}s"; } } |