Source of file DashToCamelcase.php

Size: 0,810 Bytes - Last Modified: 2015-12-22T09:12:14-05:00

../src/Filter/DashToCamelcase.php

1234567891011121314151617181920212223242526272829303132
Covered by 5 test(s):
  • MvcLite\FilterDashToCamelcaseTest::testFilter with data set #0
  • MvcLite\FilterDashToCamelcaseTest::testFilter with data set #1
  • MvcLite\FilterDashToCamelcaseTest::testFilter with data set #2
  • MvcLite\FilterDashToCamelcaseTest::testFilter with data set #3
  • MvcLite\FilterDashToCamelcaseTest::testFilter with data set #4
33
Covered by 5 test(s):
  • MvcLite\FilterDashToCamelcaseTest::testFilter with data set #0
  • MvcLite\FilterDashToCamelcaseTest::testFilter with data set #1
  • MvcLite\FilterDashToCamelcaseTest::testFilter with data set #2
  • MvcLite\FilterDashToCamelcaseTest::testFilter with data set #3
  • MvcLite\FilterDashToCamelcaseTest::testFilter with data set #4
34
Covered by 5 test(s):
  • MvcLite\FilterDashToCamelcaseTest::testFilter with data set #0
  • MvcLite\FilterDashToCamelcaseTest::testFilter with data set #1
  • MvcLite\FilterDashToCamelcaseTest::testFilter with data set #2
  • MvcLite\FilterDashToCamelcaseTest::testFilter with data set #3
  • MvcLite\FilterDashToCamelcaseTest::testFilter with data set #4
35
Covered by 5 test(s):
  • MvcLite\FilterDashToCamelcaseTest::testFilter with data set #0
  • MvcLite\FilterDashToCamelcaseTest::testFilter with data set #1
  • MvcLite\FilterDashToCamelcaseTest::testFilter with data set #2
  • MvcLite\FilterDashToCamelcaseTest::testFilter with data set #3
  • MvcLite\FilterDashToCamelcaseTest::testFilter with data set #4
363738
<?php
/**
 * dash to underscore 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;

/**
 * dash to underscore filter
 *
 * @category    PHP
 * @package     MvcLite
 * @subpackage  Filter
 * @since       Class available since release 1.1.x
 * @author      Cory Collier <corycollier@corycollier.com>
 */
class DashToCamelcase extends FilterAbstract
{
    /**
     * Filter
     */
    public function filter($word = '')
    {
        $words = explode('-', $word);
        $words = array_map('ucwords', $words);
        $words[0] = strtolower($words[0]);
        return implode('', $words);
    }
}