public static function nie($check)
{
if (!preg_match('/^([XYZ])([0-9]+)([A-Z]{1})$/', $check, $matches)) {
return false;
}
array_shift($matches);
list($first, $num, $letter) = $matches;
$num = strtr($first, 'XYZ', '012') . $num;
return $letter === static::$CODES[$num % 23];
}