function test_get_metadata()
 {
     $res = Metadata::get_namespace('email', '*****@*****.**');
     $this->assertTrue(count($res) > 0);
     $res = Metadata::get_namespace("email", '*****@*****.**', "**user%");
     $this->assertEqual($res[0], "**user.4");
     $res = Metadata::get_namespace("email", '*****@*****.**', "**man._");
     $this->assertEqual($res[0], "**man.2");
 }
 public static function by_email($email)
 {
     $res = Metadata::get_namespace('email', $email, 'user.%');
     if (!$res) {
         return null;
     }
     $namespace = $res[0];
     $res = Metadata::get('%', $namespace);
     if (!$res) {
         return null;
     }
     return new User($res[$namespace]['id'], $res[$namespace]['username'], $res[$namespace]['email'], $res[$namespace]['fullname'], $res[$namespace]['password'], $res[$namespace]['salt']);
 }