예제 #1
0
 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;
 }
예제 #2
0
 public function testSimplify()
 {
     $strAccents = "áÀãçéèÕü";
     $simplify = StringEx::simplify($strAccents);
     $this->assertEquals("aaaceeou", $simplify);
 }