private static function retrieve($typeName, $value, $returnKey = false) { $class = new ReflectionClass($typeName); $constants = $class->getConstants(); foreach ($constants as $key => $val) { $compareKey = str_replace(" ", "", StringEx::simplify($key)); $compareValue = str_replace(" ", "", StringEx::simplify($value)); if ($value === $val || $compareKey === $compareValue) { return $returnKey ? $key : $val; } } return null; }
public function testSimplify() { $strAccents = "áÀãçéèÕü"; $simplify = StringEx::simplify($strAccents); $this->assertEquals("aaaceeou", $simplify); }