| 1 | package ODS::Table::Column::Array; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use YAOO; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 1 | extends 'ODS::Table::Column::Base'; | |||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use ODS::Utils qw/clone error/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 1 | has reference => isa(boolean); | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 1 | has min_length => isa(integer); | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 1 | has max_length => isa(integer); | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 1 | has serialize_class => isa(object); | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | sub validation { | ||||||||||||||||||||||||||||
| 18 | 6 | ▶ | if (ref($_[1] || "") ne 'ARRAY') { | ||||||||||||||||||||||||||
|
Subroutine
validation: called CC=7 SCAR=27.6
Pod
undocumented
Branch: 1 branch
Condition50%1/2
$_[1] || ''
MC/DC0%0/1
$_[1] || ''
$_[1]
Truth table50%1/2
A
A= $_[1]
| |||||||||||||||||||||||||||||
| 19 | 0 | croak sprintf "The value passed to the %s column does not match the array constraint.", | |||||||||||||||||||||||||||
| 20 | $_[0]->name; | ||||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||
| 22 | 6 | ▶ | if ($_[0]->min_length && $_[0]->min_length > scalar @{$_[1]}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$_[0]->min_length and $_[0]->min_length > scalar @{$_[1];}
MC/DC0%0/2
$_[0]->min_length and $_[0]->min_length > scalar @{$_[1];}
$_[0]->min_length
$_[0]->min_length > scalar @{$_[1];}
Truth table33%1/3
A and B
A= $_[0]->min_lengthB= $_[0]->min_length > scalar @{$_[1];}
| |||||||||||||||||||||||||||||
| 23 | 0 | croak sprintf "The % column array length is less than the minimum allowed length for the attribute.", | |||||||||||||||||||||||||||
| 24 | $_[0]->name; | ||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | 6 | ▶ | if ($_[0]->max_length && $_[0]->max_length < scalar @{$_[1]}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$_[0]->max_length and $_[0]->max_length < scalar @{$_[1];}
MC/DC0%0/2
$_[0]->max_length and $_[0]->max_length < scalar @{$_[1];}
$_[0]->max_length
$_[0]->max_length < scalar @{$_[1];}
Truth table33%1/3
A and B
A= $_[0]->max_lengthB= $_[0]->max_length < scalar @{$_[1];}
| |||||||||||||||||||||||||||||
| 27 | 0 | croak sprintf "The % column array length is greater than the maximum allowed length for the attribute.", | |||||||||||||||||||||||||||
| 28 | $_[0]->name; | ||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||
| 30 | 6 | return $_[1]; | |||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | sub inflation { | ||||||||||||||||||||||||||||
| 34 | 0 | ▶ | my ($self, $value) = @_; | ||||||||||||||||||||||||||
|
Subroutine
inflation: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 35 | 0 | ▶ | if (! ref $value) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 36 | 0 | $value = $self->serialize_class->parse($value); | |||||||||||||||||||||||||||
| 37 | 0 | $self->reference(1); | |||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | 0 | return $value; | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | sub deflation { | ||||||||||||||||||||||||||||
| 43 | 4 | ▶ | my ($self, $value) = @_; | ||||||||||||||||||||||||||
|
Subroutine
deflation: called CC=3 SCAR=13.3
Pod
undocumented
| |||||||||||||||||||||||||||||
| 44 | 4 | ▶ | if ($self->reference && ref $value) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->reference and ref $value
MC/DC0%0/2
$self->reference and ref $value
$self->reference
ref $value
Truth table33%1/3
A and B
A= $self->referenceB= ref $value
| |||||||||||||||||||||||||||||
| 45 | 0 | $value = $self->serialize_class->stringify($value); | |||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | 4 | return $value; | |||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 1 | 1; | |||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | __END__ | ||||||||||||||||||||||||||||