DJabberd/Roster.pm

filter: Statementstmt 18.4% 7 / 38 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 20.0% 2 / 10 Podpod 0.0% 0 / 8 totaltotal 13.8% 9 / 65 CC 5 SCAR 18.2
CC
5
Cov
16%
add
12.0
as_xml
12.0
new
2.0
CRAP 6.1
« DJabberd/PresenceChecker/Local.pm ↑ Summary DJabberd/Stanza/DialbackVerify.pm »
1 package DJabberd::Roster;
2 17 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 17 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 sub new {
6 0 ▶ my $class = shift;
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
7 0 my $self = bless {}, $class;
8  
9 0 $self->{items} = [];
10 0 $self->{cache_gets} = 0; # times retrieved from cache
11  
12 0 return $self;
13 }
14  
15 sub inc_cache_gets {
16 0 ▶ return ++$_[0]->{cache_gets};
Subroutine inc_cache_gets: not called CC=1 SCAR=6.9
Pod undocumented
17 }
18  
19 sub cache_gets {
20 0 ▶ return $_[0]->{cache_gets};
Subroutine cache_gets: not called CC=1 SCAR=6.9
Pod undocumented
21 }
22  
23 sub add {
24 0 ▶ my $self = shift;
Subroutine add: not called CC=3 SCAR=24.8
Pod undocumented
25 0 my $item = shift;
26 0 ▶ die unless $item && $item->isa("DJabberd::RosterItem");
Branch: 1 branch
BranchTrueFalseTotal
unless $item and $item->isa("DJabberd::RosterItem") 0 0 0
Condition0%0/3
$item and $item->isa("DJabberd::RosterItem")
!ll&&!rl&&r
000
MC/DC0%0/2
$item and $item->isa("DJabberd::RosterItem")
$item $item->isa("DJabberd::RosterItem")
Truth table0%0/3
A and B
A= $itemB= $item->isa("DJabberd::RosterItem")
ABresult
0X0
100
111
27 0 push @{$self->{items}}, $item;
28 }
29  
30 sub items {
31 0 ▶ my $self = shift;
Subroutine items: not called CC=1 SCAR=6.9
Pod undocumented
32 0 return @{ $self->{items} };
33 }
34  
35 sub from_items {
36 0 ▶ my $self = shift;
Subroutine from_items: not called CC=1 SCAR=6.9
Pod undocumented
37 0 return grep { $_->subscription->sub_from } @{ $self->{items} };
38 }
39  
40 sub to_items {
41 0 ▶ my $self = shift;
Subroutine to_items: not called CC=1 SCAR=6.9
Pod undocumented
42 0 return grep { $_->subscription->sub_to } @{ $self->{items} };
43 }
44  
45 sub as_xml {
46 0 ▶ my $self = shift;
Subroutine as_xml: not called CC=3 SCAR=24.8
Pod undocumented
47 0 my $xml = "<query xmlns='jabber:iq:roster'>";
48 0 foreach my $it (@{ $self->{items} }) {
49 0 ▶ next if $it->subscription->is_none_pending_in;
Branch: 1 branch
BranchTrueFalseTotal
if $it->subscription->is_none_pending_in 0 0 0
50 0 $xml .= $it->as_xml;
51 }
52 0 $xml .= "</query>";
53 0 return $xml;
54 }
55  
56 17 1;
« DJabberd/PresenceChecker/Local.pm ↑ Summary DJabberd/Stanza/DialbackVerify.pm »