V3/_List.pm

filter: Statementstmt 62.8% 22 / 35 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 66.6% 6 / 9 Podpod 100% 1 / 1 totaltotal 46.7% 29 / 62 CC 5 SCAR 25.1
CC
5
Cov
48%
stringify
30.0
__ANON__
2.0
__ANON__
2.0
CRAP 12.3
« V3/Connection.pm ↑ Summary V3/Session/Attendees.pm »
1 package Bb::Collaborate::V3::_List;
2 7 ▶use warnings; use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 7 ▶use Mouse;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 7 ▶use Mouse::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 7 ▶use Elive::DAO::Array;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 7 extends 'Elive::DAO::Array';
9  
10 7 ▶use Scalar::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 =head1 NAME
13  
14 Bb::Collaborate::V3::_List - Base class for lists.
15  
16 =head1 DESCRIPTION
17  
18 Used as a base class for chair-persons, participants, courses and session attendees.
19  
20 =cut
21  
22 =head1 METHODS
23  
24 =cut
25  
26 =head2 add
27  
28 $list->add('111111', '222222');
29  
30 Add additional elements
31  
32 =cut
33  
34 coerce 'Bb::Collaborate::V3::_List' => from 'ArrayRef'
35 0 ▶ => via {
Subroutine __ANON__: not called CC=1 SCAR=6.9
36 0 my @items = grep {$_ ne ''} map {split(',')} @$_;
37 0 Bb::Collaborate::V3::_List->new(\@items);
38 7 };
39  
40 coerce 'Bb::Collaborate::V3::_List' => from 'Str'
41 0 ▶ => via {
Subroutine __ANON__: not called CC=1 SCAR=6.9
42 0 my @items = grep {$_ ne ''} split(',');
43  
44 0 Bb::Collaborate::V3::_List->new(\@items);
45 7 };
46  
47 =head2 stringify
48  
49 Serialises array members by joining their string values with ','. Typically
50 used to pack SOAP data, E.G. Session chair persons.
51  
52 =cut
53  
54 0 ▶sub stringify {
Subroutine stringify: not called CC=5 SCAR=34.0
Pod documented
55 0 my $self = shift;
56 0 ▶ my $arr = shift || $self;
Condition0%0/3
shift() || $self
l!l&&r!l&&!r
000
MC/DC0%0/2
shift() || $self
shift() $self
Truth table0%0/3
A || B
A= shift()B= $self
ABresult
1X1
011
000
57 0 ▶ my $type = shift || $self->element_class;
Condition0%0/3
shift() || $self->element_class
l!l&&r!l&&!r
000
MC/DC0%0/2
shift() || $self->element_class
shift() $self->element_class
Truth table0%0/3
A || B
A= shift()B= $self->element_class
ABresult
1X1
011
000
58  
59 0 ▶ $arr = [sort split(',', $arr)]
Branch: 1 branch
BranchTrueFalseTotal
if defined $arr and not builtin::reftype($arr) 0 0 0
Condition0%0/3
defined $arr and not builtin::reftype($arr)
!ll&&!rl&&r
000
MC/DC0%0/2
defined $arr and not builtin::reftype($arr)
defined $arr not builtin::reftype($arr)
Truth table0%0/3
A and not(B)
A= defined $arrB= not builtin::reftype($arr)
ABresult
0X0
100
111
60 if defined $arr && !Scalar::Util::reftype($arr);
61  
62 0 return join(',', sort map {Elive::Util::string($_, $type)} @$arr)
63 }
64  
65 7 1;
« V3/Connection.pm ↑ Summary V3/Session/Attendees.pm »