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')); }
public function filter($v) { if (empty($v)) { return ''; } $v = parent::filter($v); $v[0] = mb_strtolower($v[0]); return $v . 'Action'; }
/** * 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; }