TableContent/Table/Header.pm

filter: Statementstmt 67.8% 19 / 28 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 70.0% 7 / 10 Podpod 57.1% 4 / 7 totaltotal 66.6% 30 / 45 SCAR 0.3
CC
1
Cov
68%
add_cell
2.0
get_last_cell
2.0
unique_cells
2.0
CRAP 1.0
« TableContent/Table/Row/Cell.pm ↑ Summary TableContent/Table/Caption.pm »
1 package HTML::TableContent::Table::Header;
2  
3 20 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 20 ▶use HTML::TableContent::Table::Row::Cell;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 20 our $VERSION = '0.18';
7  
8 20 extends 'HTML::TableContent::Element';
9  
10 has 'cells' => (
11 is => 'rw',
12 lazy => 1,
13 698 ▶ default => sub { [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
14 20 );
15  
16 20 has '+html_tag' => (
17 default => 'th',
18 );
19  
20 sub add_cell {
21 0 ▶ my $cell = HTML::TableContent::Table::Row::Cell->new($_[1]);
Subroutine add_cell: not called CC=1 SCAR=6.9
Pod undocumented
22 0 push @{ $_[0]->cells }, $cell;
23 0 return $cell;
24 }
25  
26 23 ▶sub cell_count { return scalar @{ $_[0]->cells }; }
Subroutine cell_count: called CC=1 SCAR=0.0
Pod undocumented
27  
28 67 ▶sub all_cells { return @{ $_[0]->cells }; }
Subroutine all_cells: called CC=1 SCAR=0.0
Pod documented
29  
30 56 ▶sub get_cell { return $_[0]->cells->[ $_[1] ]; }
Subroutine get_cell: called CC=1 SCAR=0.0
Pod documented
31  
32 56 ▶sub get_first_cell { return $_[0]->get_cell(0); }
Subroutine get_first_cell: called CC=1 SCAR=0.0
Pod documented
33  
34 0 ▶sub get_last_cell { return $_[0]->get_cell( $_[0]->cell_count - 1 ); }
Subroutine get_last_cell: not called CC=1 SCAR=6.9
Pod documented
35  
36 sub unique_cells {
37 0 ▶ my $count_cells = { };
Subroutine unique_cells: not called CC=1 SCAR=6.9
Pod undocumented
38 0 map { $count_cells->{$_->text}++ } $_[0]->all_cells;
39 0 return $count_cells;
40 }
41  
42 20 1;
43  
44 20 __PACKAGE__->meta->make_immutable;
45  
46 __END__
« TableContent/Table/Row/Cell.pm ↑ Summary TableContent/Table/Caption.pm »