public function testGetClassNameUTF8() { $obj = new \nochso\Omni\Test\ÜTF8Namespaceöäü\ÜTF8Typeöäü(); $this->assertSame('ÜTF8Typeöäü', Type::getClassName($obj)); }
/** * Validate user input using regular expressions or callable (must return true if valid). * * @param string $input * @param string|callable|null $validator * * @return bool True if valid, false otherwise. */ private function validate($input, $validator = null) { // Always valid when there's no validator. if ($validator === null) { return true; } if (is_string($validator)) { $regex = $validator; $validator = function ($input) use($regex) { return preg_match($regex, $input) === 1; }; } if (!is_callable($validator)) { throw new \RuntimeException(sprintf("Stdio::validate must be called with a regular expression or callable. '%s' given.", Type::summarize($validator))); } return $validator($input); }