Silki/Formatter/HTMLToWiki/Table/Cell.pm

filter: Statementstmt 100% 39 / 39 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod 0.0% 0 / 1 totaltotal 98.1% 52 / 53 CC 3 SCAR 4.4
CC
3
Cov
100%
formatted_content
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.5
« Silki/Email.pm ↑ Summary Silki/HTML/FormatText.pm »
1 package Silki::Formatter::HTMLToWiki::Table::Cell;
2 {
3 1 $Silki::Formatter::HTMLToWiki::Table::Cell::VERSION = '0.29';
4 }
5  
6 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use Silki::Types qw( Int Str Bool );
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use MooseX::SemiAffordanceAccessor;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use MooseX::StrictConstructor;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 1 has colspan => (
18 is => 'ro',
19 isa => Int,
20 default => 1,
21 );
22  
23 1 has alignment => (
24 is => 'ro',
25 isa => enum( [qw( left right center )] ),
26 default => 'left',
27 );
28  
29 1 has is_header_cell => (
30 is => 'ro',
31 isa => Bool,
32 default => 0,
33 );
34  
35 1 has content => (
36 traits => ['String'],
37 is => 'rw',
38 isa => Str,
39 default => q{},
40 handles => {
41 append_content => 'append',
42 },
43 init_arg => undef,
44 );
45  
46 38 ▶sub formatted_content {
Subroutine formatted_content: called CC=3 SCAR=11.0
Pod undocumented
47 38 my $self = shift;
48 38 my $width = shift;
49  
50 38 $width += 4 * ( $self->colspan() - 1 );
51  
52 38 ▶ my $format
Branch: 2 branches
BranchTrueFalseTotal
$self->alignment eq 'left' ? : 32 6 38
$self->alignment eq 'right' ? : 3 3 6
53 = $self->alignment() eq 'left' ? " %-${width}s "
54 : $self->alignment() eq 'right' ? " %${width}s "
55 : " %-${width}s ";
56  
57 38 my $content = $self->content();
58 38 $content =~ s/\n/ /g;
59  
60 38 return sprintf( $format, $content );
61 }
62  
63 1 __PACKAGE__->meta()->make_immutable();
64  
65 1 1;
« Silki/Email.pm ↑ Summary Silki/HTML/FormatText.pm »