| 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
Condition0%0/3
$item and $item->isa("DJabberd::RosterItem")
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")
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 50 | 0 | $xml .= $it->as_xml; | |||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | 0 | $xml .= "</query>"; | |||||||||||||||||||||||||||
| 53 | 0 | return $xml; | |||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 20 | 1; | |||||||||||||||||||||||||||