Elive/Entity/InvitedGuest.pm

filter: Statementstmt 87.5% 35 / 40 Branchbran 33.3% 2 / 6 Conditioncond 50.0% 3 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 88.8% 8 / 9 Podpod 100% 2 / 2 totaltotal 74.6% 50 / 67 CC 6 SCAR 10.8
CC
6
Cov
77%
BUILDARGS
6.0
stringify
3.1
_retrieve_all
2.0
CRAP 2.9
« Elive/DAO/Array.pm ↑ Summary Elive/Entity/Group/Members.pm »
1 package Elive::Entity::InvitedGuest;
2 23 ▶use warnings; use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 23 ▶use Mouse;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 23 ▶use Mouse::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 23 extends 'Elive::Entity';
8  
9 23 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 23 __PACKAGE__->entity_name('InvitedGuest');
12 23 __PACKAGE__->collection_name('InvitedGuests');
13  
14 23 has 'invitedGuestId' => (is => 'rw', isa => 'Int');
15 23 __PACKAGE__->_alias(id => 'invitedGuestId');
16  
17 23 has 'loginName' => (is => 'rw', isa => 'Str',
18 documentation => "Guest's login name (usually an email address)");
19  
20 23 has 'displayName' => (is => 'rw', isa => 'Str',
21 documentation => "Guest's display name");
22  
23 sub BUILDARGS {
24 6 ▶ my $class = shift;
Subroutine BUILDARGS: called CC=4 SCAR=17.9
Pod documented
25 6 my $spec = shift;
26  
27 6 my $args;
28  
29 6 ▶ if ($spec && ! ref $spec) {
Branch: 1 branch
BranchTrueFalseTotal
if ($spec and not ref $spec) { } 0 6 6
Condition33%1/3
$spec and not ref $spec
!ll&&!rl&&r
060
MC/DC0%0/2
$spec and not ref $spec
$spec not ref $spec
Truth table33%1/3
A and not(B)
A= $specB= not ref $spec
ABresult
0X0
100
111
30 0 ▶ if ($spec =~ m{^ \s*
Branch: 1 branch
BranchTrueFalseTotal
if ($spec =~ /^ \s* ([^;]*?) # display name \s* \( ([^;\)]+) \) # (login name) \s* (= (\d) \s*)? # possible '=role' (ignored) $/x) { } 0 0 0
31 ([^;]*?) # display name
32 \s*
33 \( ([^;\)]+) \) # (login name)
34 \s*
35 (= (\d) \s*)? # possible '=role' (ignored)
36 $}x) {
37  
38 0 $args = {displayName => $1, loginName => $2};
39 }
40 else {
41 0 die "invited guest '$spec': not in format: <Display Name>(<user-id>)'";
42 }
43 }
44 else {
45 6 $args = $spec;
46 }
47  
48 6 return $args;
49 }
50  
51 coerce 'Elive::Entity::InvitedGuest' => from 'HashRef|Str'
52 6 ▶ => via {Elive::Entity::InvitedGuest->new($_)};
Subroutine __ANON__: called CC=1 SCAR=0.0
53  
54 =head1 NAME
55  
56 Elive::Entity::InvitedGuest - Invited Guest entity class
57  
58 =head1 DESCRIPTION
59  
60 This is the structural class for an invited guest. It is associated with
61 meetings via the L<Elive::Entity::Participant> entity.
62  
63 =cut
64  
65 =head1 METHODS
66  
67 =cut
68  
69 =head2 stringify
70  
71 Serialize a guest as <displayName> (<loginName>): e.g. C<Robert (bob@acme.com)>.
72  
73 =cut
74  
75 sub stringify {
76 30 ▶ my $self = shift;
Subroutine stringify: called CC=3 SCAR=11.3
Pod documented
77 30 ▶ my $data = shift || $self;
Condition66%2/3
shift() || $self
l!l&&r!l&&!r
2550
MC/DC0%0/2
shift() || $self
shift() $self
Truth table66%2/3
A || B
A= shift()B= $self
ABresult
1X1
011
000
78  
79 30 ▶ return $data
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::refaddr($data) 0 30 30
80 unless Scalar::Util::refaddr($data);
81  
82 30 return sprintf("%s (%s)", $data->{displayName}, $data->{loginName});
83 }
84  
85 sub _retrieve_all {
86 0 ▶ my ($class, $vals, %opt) = @_;
Subroutine _retrieve_all: not called CC=1 SCAR=6.9
87  
88 #
89 # No getXxxx command use listXxxx
90 #
91 0 return $class->SUPER::_retrieve_all($vals,
92 command => 'listInvitedGuests',
93 %opt);
94 }
95  
96 =head1 SEE ALSO
97  
98 =over 4
99  
100 =item Elive::Entity::Session
101 =item Elive::Entity::Meeting
102  
103 =back
104  
105 =cut
106  
107 23 1;
« Elive/DAO/Array.pm ↑ Summary Elive/Entity/Group/Members.pm »