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 20 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 20 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
6 0 my $class = shift;
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 0 ▶sub inc_cache_gets {
Subroutine inc_cache_gets: not called CC=1 SCAR=6.9
Pod undocumented
16 0 return ++$_[0]->{cache_gets};
17 }
18  
19 0 ▶sub cache_gets {
Subroutine cache_gets: not called CC=1 SCAR=6.9
Pod undocumented
20 0 return $_[0]->{cache_gets};
21 }
22  
23 0 ▶sub add {
Subroutine add: not called CC=3 SCAR=24.8
Pod undocumented
24 0 my $self = shift;
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 0 ▶sub items {
Subroutine items: not called CC=1 SCAR=6.9
Pod undocumented
31 0 my $self = shift;
32 0 return @{ $self->{items} };
33 }
34  
35 0 ▶sub from_items {
Subroutine from_items: not called CC=1 SCAR=6.9
Pod undocumented
36 0 my $self = shift;
37 0 return grep { $_->subscription->sub_from } @{ $self->{items} };
38 }
39  
40 0 ▶sub to_items {
Subroutine to_items: not called CC=1 SCAR=6.9
Pod undocumented
41 0 my $self = shift;
42 0 return grep { $_->subscription->sub_to } @{ $self->{items} };
43 }
44  
45 0 ▶sub as_xml {
Subroutine as_xml: not called CC=3 SCAR=24.8
Pod undocumented
46 0 my $self = shift;
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 20 1;
« DJabberd/PresenceChecker/Local.pm ↑ Summary DJabberd/Stanza/DialbackVerify.pm »