Signed-off-by: Francois Gouget fgouget@codeweavers.com --- This is really just cosmetic and should not make any difference to how the website works. --- testbot/lib/ObjectModel/Collection.pm | 68 +++++---------------------- 1 file changed, 13 insertions(+), 55 deletions(-)
diff --git a/testbot/lib/ObjectModel/Collection.pm b/testbot/lib/ObjectModel/Collection.pm index 782f32c23..dd0be12d5 100644 --- a/testbot/lib/ObjectModel/Collection.pm +++ b/testbot/lib/ObjectModel/Collection.pm @@ -195,7 +195,6 @@ sub Load($) my ($self) = @_;
$self->GetBackEnd()->LoadCollection($self); - $self->{Loaded} = 1; }
@@ -252,11 +251,7 @@ sub GetKeys($) { my ($self) = @_;
- if (! $self->{Loaded}) - { - $self->Load(); - } - + $self->Load() if (!$self->{Loaded}); return $self->GetKeysNoLoad(); }
@@ -370,16 +365,9 @@ sub ItemExists($$) { my ($self, $Key) = @_;
- if (! defined($Key)) - { - return !1; - } - - if (! $self->{Loaded}) - { - $self->Load(); - } + return !1 if (!defined $Key);
+ $self->Load() if (!$self->{Loaded}); return exists($self->{Items}{$Key}); }
@@ -399,11 +387,7 @@ sub GetItems($) { my ($self) = @_;
- if (! $self->{Loaded}) - { - $self->Load(); - } - + $self->Load() if (!$self->{Loaded}); my @Items = values %{$self->{Items}}; return @Items; } @@ -422,11 +406,7 @@ sub GetItemsCount($) { my ($self) = @_;
- if (! $self->{Loaded}) - { - $self->Load(); - } - + $self->Load() if (!$self->{Loaded}); return scalar(keys %{$self->{Items}}); }
@@ -444,10 +424,7 @@ sub IsEmpty($) { my ($self) = @_;
- if (! $self->{Loaded}) - { - $self->Load(); - } + $self->Load() if (!$self->{Loaded});
# Even though scalar(hash) does not return the number of items in Perl 5.20 # (and cannot generally be compared to numbers), it evaluates to true for @@ -468,7 +445,6 @@ sub SplitKey($$) my ($self, $CombinedKey) = @_;
my @KeyComponents = split /#@#/, $CombinedKey; - return @KeyComponents; }
@@ -564,11 +540,7 @@ sub Save($) my ($self) = @_;
my ($ErrKey, $ErrProperty, $ErrMessage) = $self->Validate(); - if (! defined($ErrMessage)) - { - $self->SaveNoValidate(); - } - + $self->SaveNoValidate() if (!defined $ErrMessage);
return ($ErrKey, $ErrProperty, $ErrMessage); } @@ -637,16 +609,11 @@ sub DeleteItem($$) my ($self, $Item) = @_;
my $ErrMessage = $Item->OnDelete(); - if (defined($ErrMessage)) - { - return $ErrMessage; - } + return $ErrMessage if (defined $ErrMessage); + my $Key = $Item->GetKey(); $ErrMessage = $self->GetBackEnd()->DeleteItem($Item); - if (defined($ErrMessage)) - { - return $ErrMessage; - } + return $ErrMessage if (defined $ErrMessage);
my $FullKey = $self->GetFullKey($Key); if (defined $FullKey) @@ -663,24 +630,15 @@ sub DeleteAll($) { my ($self) = @_;
- if (! $self->{Loaded}) - { - $self->Load(); - } + $self->Load() if (!$self->{Loaded}); foreach my $Item (values %{$self->{Items}}) { my $ErrMessage = $Item->OnDelete(); - if (defined($ErrMessage)) - { - return $ErrMessage; - } + return $ErrMessage if (defined $ErrMessage); }
my $ErrMessage = $self->GetBackEnd()->DeleteAll($self); - if (defined($ErrMessage)) - { - return $ErrMessage; - } + return $ErrMessage if (defined $ErrMessage);
my $ScopeItems = $self->{AllScopeItems}->{ref($self)}; foreach my $Key (keys %{$self->{Items}})