Elive/Entity/Role.pm

filter: Statementstmt 100% 31 / 31 Branchbran 100% 2 / 2 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 7 / 7 Podpod 100% 1 / 1 totaltotal 95.6% 44 / 46 CC 3 SCAR 5.1
CC
3
Cov
97%
BUILDARGS
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.7
« Elive/DAO/_Base.pm ↑ Summary Elive/Entity/Preloads.pm »
1 package Elive::Entity::Role;
2 33 ▶use warnings; use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 33 ▶use Mouse;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 33 ▶use Mouse::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 33 extends 'Elive::Entity';
8  
9 =head1 NAME
10  
11 Elive::Entity::Role - Elluminate Role entity class
12  
13 =head1 DESCRIPTION
14  
15 This is a structural class for Elive roles. It is a component of the
16 L<Elive::Entity::User> and L<Elive::Entity::Participants::Participant>
17 entities.
18  
19 =cut
20  
21 33 __PACKAGE__->entity_name('Role');
22  
23 33 has 'roleId' => (is => 'rw', isa => 'Int', required => 1);
24 33 __PACKAGE__->primary_key('roleId');
25  
26 33 our ( $SYSTEM_ADMIN, $APPLICATION_ADMIN, $MODERATOR, $PARTICIPANT );
27 BEGIN {
28 33 ▶ $SYSTEM_ADMIN = 0;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 33 $APPLICATION_ADMIN = 1;
30 33 $MODERATOR = 2;
31 33 $PARTICIPANT = 3;
32 }
33  
34 sub BUILDARGS {
35 272 ▶ my $class = shift;
Subroutine BUILDARGS: called CC=3 SCAR=11.0
Pod documented
36 272 my $spec = shift;
37  
38 272 my $args;
39 272 ▶ if (defined $spec && ! ref $spec) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $spec and not ref $spec) { } 51 221 272
Condition66%2/3
defined $spec and not ref $spec
!ll&&!rl&&r
022151
MC/DC50%1/2
defined $spec and not ref $spec
defined $spec not ref $spec
Truth table66%2/3
A and not(B)
A= defined $specB= not ref $spec
ABresult
0X0
100
111
40 51 $args = {roleId => $spec};
41 }
42 else {
43 221 $args = $spec;
44 }
45  
46 272 return $args;
47 }
48  
49 coerce 'Elive::Entity::Role' => from 'HashRef|Int'
50 270 ▶ => via {Elive::Entity::Role->new($_) };
Subroutine __ANON__: called CC=1 SCAR=0.0
51  
52 33 1;
« Elive/DAO/_Base.pm ↑ Summary Elive/Entity/Preloads.pm »