예제 #1
0
 public function testFilter()
 {
     $filter = new CapWords();
     $this->assertEquals('Test', $filter->filter('TEsT'));
     $this->assertEquals('SecondTest', $filter->filter('Second-tesT'));
     $this->assertEquals('TheThirdTest', $filter->filter('the_third-test'));
     $this->assertEquals('TheFinalForthTest', $filter->filter('the_final forth-test'));
 }
예제 #2
0
 /**
  * Set the config
  *
  * @param \Hynage\Config $config
  * @return \Hynage\Form\HtmlForm
  */
 public function setConfig(Config $config)
 {
     foreach ($config as $key => $value) {
         $filter = new Filter\String\CapWords();
         $method = 'set' . $filter->filter($key);
         if (method_exists($this, $method)) {
             $this->{$method}($value);
         }
     }
     return $this;
 }
예제 #3
0
 public function filter($v)
 {
     if (empty($v)) {
         return '';
     }
     $v = parent::filter($v);
     $v[0] = mb_strtolower($v[0]);
     return $v . 'Action';
 }