Webqq/Group/Member.pm

filter: Statementstmt 15.7% 9 / 57 Branchbran 0.0% 0 / 24 Conditioncond 0.0% 0 / 12 MC/DCmcdc 0.0% 0 / 7 Subroutinesub 15.3% 2 / 13 Podpod 0.0% 0 / 9 totaltotal 9.0% 11 / 122 CC 18 SCAR 35.5
CC
18
Cov
10%
update
72.0
displayname
56.0
card
12.0
CRAP 34.7
« Webqq/Friend.pm ↑ Summary Webqq/Discuss/Member.pm »
1 package Mojo::Webqq::Group::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 province
7 sex
8 id
9 country
10 city
11 fullcard
12 state
13 client_type
14 qage
15 join_time
16 last_speak_time
17 level
18 role
19 bad_record
20 _flag
21 _group_id
22 )];
23 0 ▶sub card { # from Mojo::Webqq::Base
Subroutine card: not called CC=3 SCAR=24.8
Pod undocumented
24 0 my $self = shift;
25 0 ▶ if (@_ == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 0) 0 0 0
26 0 ▶ return defined $self->fullcard ? $self->fullcard : $self->{card};
Branch: 1 branch
BranchTrueFalseTotal
defined $self->fullcard ? : 0 0 0
27 }
28 0 $self->{card} = shift;
29 0 $self;
30 };
31 0 ▶has uid => sub{
Subroutine __ANON__: not called CC=2 SCAR=17.9
32 0 my $self = shift;
33 0 ▶ return $self->{uid} if defined $self->{uid};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"uid"} 0 0 0
34 0 return $self->client->get_qq_from_id($self->id);
35 1 };
36 0 ▶sub qq {$_[0]->uid}
Subroutine qq: not called CC=1 SCAR=6.9
Pod undocumented
37 0 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: not called CC=2 SCAR=17.9
38 0 my $self = shift;
39 0 ▶ if($Mojo::Webqq::Group::Member::AUTOLOAD =~ /.*::g(.*)/){
Branch: 1 branch
BranchTrueFalseTotal
if ($Mojo::Webqq::Group::Member::AUTOLOAD =~ /.*::g(.*)/) { } 0 0 0
40 0 my $attr = $1;
41 0 $self->group->$attr(@_);
42 }
43 0 else{die("undefined subroutine $Mojo::Webqq::Group::Member::AUTOLOAD");}
44 }
45 0 ▶sub nick {$_[0]->name};
Subroutine nick: not called CC=1 SCAR=6.9
Pod undocumented
46 0 ▶sub displayname {
Subroutine displayname: not called CC=7 SCAR=40.3
Pod undocumented
47 0 my $self = shift;
48 0 ▶ if($self->client->group_member_use_friend_markname){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->client->group_member_use_friend_markname) { } 0 0 0
49 0 my $f = $self->client->search_friend(id=>$self->id);
50 0 ▶ if(defined $f){
Branch: 1 branch
BranchTrueFalseTotal
if (defined $f) { } 0 0 0
51 0 ▶ return $f->markname // $self->card // $self->name;
Condition0%0/6
($f->markname // $self->card) // $self->name
l!l&&r!l&&!r
000
$f->markname // $self->card
l!l&&r!l&&!r
000
MC/DC0%0/3
($f->markname // $self->card) // $self->name
$f->markname $self->card $self->name
Truth table0%0/4
A // B // C
A= $f->marknameB= $self->cardC= $self->name
ABCresult
1XX1
01X1
0011
0000
52 }
53 else{
54 0 ▶ return defined $self->card?$self->card:$self->name;
Branch: 1 branch
BranchTrueFalseTotal
defined $self->card ? : 0 0 0
55 }
56 }
57 else{
58 0 ▶ return defined $self->card?$self->card:$self->name;
Branch: 1 branch
BranchTrueFalseTotal
defined $self->card ? : 0 0 0
59 }
60 }
61  
62 0 ▶sub update{
Subroutine update: not called CC=8 SCAR=42.8
Pod undocumented
63 0 my $self = shift;
64 0 my $hash = shift;
65 0 for(grep {substr($_,0,1) ne "_"} keys %$hash){
66 0 ▶ if(exists $hash->{$_}){
Branch: 1 branch
BranchTrueFalseTotal
if (exists $hash->{$_}) 0 0 0
67 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
68 0 ▶ if($hash->{$_} ne $self->{$_}){
Branch: 1 branch
BranchTrueFalseTotal
if ($hash->{$_} ne $self->{$_}) 0 0 0
69 0 my $old_property = $self->{$_};
70 0 my $new_property = $hash->{$_};
71 0 $self->{$_} = $hash->{$_};
72 0 $self->client->emit("group_member_property_change"=>$self,$_,$old_property,$new_property);
73 }
74 }
75 ▶ 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
76 0 my $old_property = $self->{$_};
77 0 my $new_property = $hash->{$_};
78 0 $self->{$_} = $hash->{$_};
79 0 $self->client->emit("group_member_property_change"=>$self,$_,$old_property,$new_property);
80 }
81 }
82 }
83 0 $self;
84 }
85  
86 0 ▶sub send {
Subroutine send: not called CC=1 SCAR=6.9
Pod undocumented
87 0 my $self = shift;
88 0 $self->client->send_sess_message($self,@_);
89 }
90 0 ▶sub set_card {
Subroutine set_card: not called CC=1 SCAR=6.9
Pod undocumented
91 0 my $self = shift;
92 0 my $card = shift;
93 0 $self->group->set_group_member_card($self,$card);
94 }
95 0 ▶sub group {
Subroutine group: not called CC=1 SCAR=6.9
Pod undocumented
96 0 my $self = shift;
97 0 return scalar $self->client->search_group(id=>$self->_group_id);
98 }
99 0 ▶sub shutup{
Subroutine shutup: not called CC=1 SCAR=6.9
Pod undocumented
100 0 my $self = shift;
101 0 my $time = shift;
102 0 $self->group->shutup_group_member($time,$self);
103 }
104 1 1;
105  
« Webqq/Friend.pm ↑ Summary Webqq/Discuss/Member.pm »