| 1 | package ODS::Table::Column::Base; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use YAOO; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use ODS::Utils qw/clone error/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 2 | auto_build; | |||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 2 | has name => rw, isa(string); | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 2 | has type => rw, isa(string); | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 2 | has value => rw, isa(any); | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 2 | has mandatory => rw, isa(boolean); | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 2 | has no_render => rw, isa(boolean); | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 2 | has sortable => rw, isa(any); | |||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 2 | has filterable => rw, isa(any); | |||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 2 | has field => rw, isa(hash); | |||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 2 | has inflated => rw, isa(boolean); | |||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | sub build_column { | ||||||||||||||||||||||||||||
| 28 | 30 | ▶ | my ($self, $data, $already_inflated) = @_; | ||||||||||||||||||||||||||
|
Subroutine
build_column: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 30 | $self = clone($self); | |||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 30 | $self->inflated($already_inflated); | |||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 30 | $self->value($data); | |||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 30 | $self->inflate($data); | |||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 30 | return $self; | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | sub store_column { | ||||||||||||||||||||||||||||
| 42 | 66 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
store_column: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 66 | return $self->validate()->deflate(); | |||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | sub validate { | ||||||||||||||||||||||||||||
| 48 | 79 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
validate: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | # has_validation_class | ||||||||||||||||||||||||||||
| 51 | 79 | ▶ | return $self unless $self->can('validation'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 79 | $self->value( | |||||||||||||||||||||||||||
| 54 | $self->validation($self->value) | ||||||||||||||||||||||||||||
| 55 | ); | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 79 | return $self; | |||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | sub inflate { | ||||||||||||||||||||||||||||
| 61 | 30 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
inflate: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | # has_validation_class | ||||||||||||||||||||||||||||
| 64 | 30 | ▶ | return $self unless not $self->inflated and $self->can('inflation'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $self->inflated and $self->can("inflation")
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")
| |||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 3 | $self->value( | |||||||||||||||||||||||||||
| 67 | $self->inflation($self->value) | ||||||||||||||||||||||||||||
| 68 | ); | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | 3 | $self->inflated(1); | |||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | 3 | return $self; | |||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | sub deflate { | ||||||||||||||||||||||||||||
| 76 | 66 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
deflate: called CC=3 SCAR=14.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | # has_validation_class | ||||||||||||||||||||||||||||
| 79 | 66 | ▶ | return $self unless $self->inflated && $self->can('deflation'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->inflated and $self->can("deflation")
MC/DC0%0/2
$self->inflated and $self->can("deflation")
$self->inflated
$self->can("deflation")
Truth table66%2/3
A and B
A= $self->inflatedB= $self->can("deflation")
| |||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | 0 | $self->value( | |||||||||||||||||||||||||||
| 82 | $self->deflation($self->value) | ||||||||||||||||||||||||||||
| 83 | ); | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | 0 | $self->inflated(0); | |||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | 0 | return $self; | |||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | sub coerce { | ||||||||||||||||||||||||||||
| 91 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
coerce: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | 0 | ▶ | return unless $self->can('coercion'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | 0 | $self->value( | |||||||||||||||||||||||||||
| 96 | $self->coercion($self->value) | ||||||||||||||||||||||||||||
| 97 | ); | ||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | 2 | 1; | |||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | __END__ | ||||||||||||||||||||||||||||