ODS/Table/Column/Base.pm

filter: Statementstmt 100% 40 / 40 Branchbran 100% 8 / 8 Conditioncond 88.8% 8 / 9 MC/DCmcdc 83.3% 5 / 6 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 5 totaltotal 90.6% 68 / 75 CC 8 SCAR 8.9
CC
8
Cov
98%
build_column
3.0
inflate
3.0
deflate
3.0
CRAP 2.4
« ODS/Utils.pm ↑ Summary ODS/Table/Column/Integer.pm »
1 package ODS::Table::Column::Base;
2  
3 72 ▶use YAOO;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 72 ▶use ODS::Utils qw/clone error/;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 72 auto_build;
8  
9 72 has name => rw, isa(string);
10  
11 72 has type => rw, isa(string);
12  
13 72 has value => rw, isa(any);
14  
15 72 has mandatory => rw, isa(boolean);
16  
17 72 has no_render => rw, isa(boolean);
18  
19 72 has sortable => rw, isa(any);
20  
21 72 has filterable => rw, isa(any);
22  
23 72 has field => rw, isa(hash);
24  
25 72 has inflated => rw, isa(boolean);
26  
27 sub build_column {
28 39374 ▶ my ($self, $data, $already_inflated, $serialize) = @_;
Subroutine build_column: called CC=3 SCAR=11.0
Pod undocumented
29  
30 39374 $self = clone($self);
31  
32 39374 ▶ $self->serialize_class($serialize) if $serialize && $self->can('serialize_class');
Branch: 1 branch
BranchTrueFalseTotal
if $serialize and $self->can("serialize_class") 10 39364 39374
Condition66%2/3
$serialize and $self->can("serialize_class")
!ll&&!rl&&r
03936410
MC/DC50%1/2
$serialize and $self->can("serialize_class")
$serialize $self->can("serialize_class")
Truth table66%2/3
A and B
A= $serializeB= $self->can("serialize_class")
ABresult
0X0
100
111
33  
34 39374 $self->inflated($already_inflated);
35  
36 39374 $self->value($data);
37  
38 39374 $self->inflate($data);
39  
40 39374 return $self;
41 }
42  
43 sub store_column {
44 25816 ▶ my ($self) = @_;
Subroutine store_column: called CC=1 SCAR=0.0
Pod undocumented
45  
46 25816 return $self->validate()->deflate();
47 }
48  
49 sub validate {
50 51581 ▶ my ($self) = @_;
Subroutine validate: called CC=2 SCAR=6.9
Pod undocumented
51  
52 # has_validation_class
53 51581 ▶ return $self unless $self->can('validation');
Branch: 1 branch
BranchTrueFalseTotal
unless $self->can("validation") 6844 44737 51581
54  
55 44737 $self->value(
56 $self->validation($self->value)
57 );
58  
59 44737 return $self;
60 }
61  
62 sub inflate {
63 39374 ▶ my ($self) = @_;
Subroutine inflate: called CC=3 SCAR=11.0
Pod undocumented
64  
65 # has_validation_class
66 39374 ▶ return $self unless not $self->inflated and $self->can('inflation');
Branch: 1 branch
BranchTrueFalseTotal
unless not $self->inflated and $self->can("inflation") 36639 2735 39374
Condition100%3/3
not $self->inflated and $self->can("inflation")
!ll&&!rl&&r
25688109512735
MC/DC100%2/2
not $self->inflated and $self->can("inflation")
not $self->inflated $self->can("inflation")
Truth table100%3/3
not(A) and B
A= not $self->inflatedB= $self->can("inflation")
ABresult
0X0
100
111
67  
68 2735 $self->value(
69 $self->inflation($self->value)
70 );
71  
72 2735 $self->inflated(1);
73  
74 2735 return $self;
75 }
76  
77 sub deflate {
78 25816 ▶ my ($self) = @_;
Subroutine deflate: called CC=3 SCAR=11.0
Pod undocumented
79  
80 # has_validation_class
81 25816 ▶ return $self unless $self->inflated && $self->can('deflation');
Branch: 1 branch
BranchTrueFalseTotal
unless $self->inflated and $self->can("deflation") 20671 5145 25816
Condition100%3/3
$self->inflated and $self->can("deflation")
!ll&&!rl&&r
108205635145
MC/DC100%2/2
$self->inflated and $self->can("deflation")
$self->inflated $self->can("deflation")
Truth table100%3/3
A and B
A= $self->inflatedB= $self->can("deflation")
ABresult
0X0
100
111
82  
83 5145 $self->value(
84 $self->deflation($self->value)
85 );
86  
87 5145 $self->inflated(0);
88  
89 5145 return $self;
90 }
91  
92 72 1;
93  
94 __END__
« ODS/Utils.pm ↑ Summary ODS/Table/Column/Integer.pm »