-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCertificateProblem.m
77 lines (64 loc) · 1.45 KB
/
CertificateProblem.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//
// CertificateProblem.m
// CertificateHelper
//
// Created by Karsten Kusche on 30.12.11.
// Copyright 2011 Briksoftware.com. All rights reserved.
//
#import "CertificateProblem.h"
@implementation CertificateProblem
- (NSString*)htmlDescription
{
return @"erm... nothing wrong, everything should work";
}
- (NSArray*)infoObjects
{
return [NSArray array];
}
+ (NSMutableDictionary*)subclassRegistry
{
static NSMutableDictionary* subclassRegistry = nil;
if (subclassRegistry == nil)
{
subclassRegistry = [NSMutableDictionary dictionary];
[subclassRegistry retain];
}
return subclassRegistry;
}
+ (void)registerSubclass
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
[[self subclassRegistry] setObject: self forKey:[self className]];
[pool drain];
}
+ (id)currentProblem
{
NSMutableArray* problems = [NSMutableArray array];
for (Class problemClass in [[self subclassRegistry] allValues])
{
id problem = [problemClass problemIfExists];
if (problem)
{
[problems addObject: problem];
}
}
[problems sortedArrayUsingSelector:@selector(severity)];
return [problems lastObject];
}
+ (id)problem
{
CertificateProblem* problem = [[self alloc] init];
[problem autorelease];
return problem;
}
+ (id)problemIfExists
{
// if the problem exists, return an instance. Otherwise return nil;
return nil;
}
- (ProblemSeverity)severity
{
// used to sort the problems, the problem with the highest count is taken
return veryLow;
}
@end