Webqq/Discuss/Member.pm

filter: Statementstmt 20.4% 9 / 44 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 20.0% 2 / 10 Podpod 0.0% 0 / 6 totaltotal 12.3% 11 / 89 CC 12 SCAR 34.3
CC
12
Cov
13%
update
72.0
displayname
12.0
__ANON__
6.0
CRAP 30.8
« Webqq/Group/Member.pm ↑ Summary Webqq/Message/Emoji.pm »
1 package Mojo::Webqq::Discuss::Member;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use Mojo::Webqq::Base 'Mojo::Webqq::Model::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 has [qw(
5 name
6 id
7 state
8 client_type
9 _discuss_id
10 _flag
11 )];
12  
13 0 ▶has uid => sub{
Subroutine __ANON__: not called CC=2 SCAR=17.9
14 0 my $self = shift;
15 0 ▶ return $self->{uid} if defined $self->{uid};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"uid"} 0 0 0
16 0 return $self->client->get_qq_from_id($self->id);
17 1 };
18 0 ▶sub qq {$_[0]->uid}
Subroutine qq: not called CC=1 SCAR=6.9
Pod undocumented
19 0 ▶sub nick {$_[0]->name}
Subroutine nick: not called CC=1 SCAR=6.9
Pod undocumented
20 0 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: not called CC=2 SCAR=17.9
21 0 my $self = shift;
22 0 ▶ if($Mojo::Webqq::Discuss::Member::AUTOLOAD =~ /.*::d(.*)/){
Branch: 1 branch
BranchTrueFalseTotal
if ($Mojo::Webqq::Discuss::Member::AUTOLOAD =~ /.*::d(.*)/) { } 0 0 0
23 0 my $attr = $1;
24 0 $self->group->$attr(@_);
25 }
26 0 else{die("undefined subroutine $Mojo::Webqq::Discuss::Member::AUTOLOAD");}
27 }
28 0 ▶sub displayname {
Subroutine displayname: not called CC=3 SCAR=24.8
Pod undocumented
29 0 my $self = shift;
30 0 my $f = $self->client->search_friend(id=>$self->id);
31 0 ▶ if(defined $f){
Branch: 1 branch
BranchTrueFalseTotal
if (defined $f) { } 0 0 0
32 0 ▶ return $f->markname // $self->name;
Condition0%0/3
$f->markname // $self->name
l!l&&r!l&&!r
000
MC/DC0%0/2
$f->markname // $self->name
$f->markname $self->name
Truth table0%0/3
A // B
A= $f->marknameB= $self->name
ABresult
1X1
011
000
33 }
34 else{
35 0 return $self->name;
36 }
37 }
38 0 ▶sub update{
Subroutine update: not called CC=8 SCAR=42.8
Pod undocumented
39 0 my $self = shift;
40 0 my $hash = shift;
41 0 for(grep {substr($_,0,1) ne "_"} keys %$hash){
42 0 ▶ if(exists $hash->{$_}){
Branch: 1 branch
BranchTrueFalseTotal
if (exists $hash->{$_}) 0 0 0
43 0 ▶ if(defined $hash->{$_} and defined $self->{$_}){
Branch: 2 branches
BranchTrueFalseTotal
if (defined $hash->{$_} and defined $self->{$_}) { } 0 0 0
elsif (not !(defined $hash->{$_} || defined $self->{$_})) { } 0 0 0
Condition0%0/3
defined $hash->{$_} and defined $self->{$_}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $hash->{$_} and defined $self->{$_}
defined $hash->{$_} defined $self->{$_}
Truth table0%0/3
A and B
A= defined $hash->{$_}B= defined $self->{$_}
ABresult
0X0
100
111
44 0 ▶ if($hash->{$_} ne $self->{$_}){
Branch: 1 branch
BranchTrueFalseTotal
if ($hash->{$_} ne $self->{$_}) 0 0 0
45 0 my $old_property = $self->{$_};
46 0 my $new_property = $hash->{$_};
47 0 $self->{$_} = $hash->{$_};
48 0 $self->client->emit("discuss_member_property_change"=>$self,$_,$old_property,$new_property);
49 }
50 }
51 ▶ elsif( ! (!defined $hash->{$_} and !defined $self->{$_}) ){
Condition0%0/3
defined $hash->{$_} || defined $self->{$_}
l!l&&r!l&&!r
000
MC/DC0%0/2
defined $hash->{$_} || defined $self->{$_}
defined $hash->{$_} defined $self->{$_}
Truth table0%0/3
A || B
A= defined $hash->{$_}B= defined $self->{$_}
ABresult
1X1
011
000
52 0 my $old_property = $self->{$_};
53 0 my $new_property = $hash->{$_};
54 0 $self->{$_} = $hash->{$_};
55 0 $self->client->emit("discuss_member_property_change"=>$self,$_,$old_property,$new_property);
56 }
57 }
58 }
59 0 $self;
60 }
61  
62 0 ▶sub send {
Subroutine send: not called CC=1 SCAR=6.9
Pod undocumented
63 0 my $self = shift;
64 0 $self->client->send_sess_message($self,@_);
65 }
66  
67 0 ▶sub discuss {
Subroutine discuss: not called CC=1 SCAR=6.9
Pod undocumented
68 0 my $self = shift;
69 0 return scalar $self->client->search_discuss(id=>$self->_discuss_id);
70 }
71  
72 1 1;
« Webqq/Group/Member.pm ↑ Summary Webqq/Message/Emoji.pm »