XSS/Text.pm

filter: Statementstmt 100% 37 / 37 Branchbran 100% 6 / 6 Conditioncond 60.0% 3 / 5 MC/DCmcdc 33.3% 1 / 3 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 91.3% 53 / 58 CC 8 SCAR 14.8
CC
8
Cov
96%
apply
7.0
clear
2.0
BEGIN
1.0
CRAP 4.4
« XSS/Stylesheet/HTML2TD.pm ↑ Summary XSS/Role/StyleAttribute.pm »
1 package XML::XSS::Text;
2 15 our $AUTHORITY = 'cpan:YANICK';
3 # ABSTRACT: XML::XSS text stylesheet rule
4 15 $XML::XSS::Text::VERSION = '0.3.5';
5  
6  
7 15 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 15 ▶use MooseX::SemiAffordanceAccessor;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 15 ▶use MooseX::Clone;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 15 with 'XML::XSS::Role::Renderer', 'MooseX::Clone';
12  
13 15 ▶no warnings qw/ uninitialized /;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15  
16  
17 15 has replace => (
18 traits => [ qw/ XML::XSS::Role::StyleAttribute Clone / ]
19 );
20  
21  
22 15 has filter => (
23 traits => [ qw/ XML::XSS::Role::StyleAttribute Clone / ]
24 );
25  
26  
27  
28 15 has [ qw/ pre post / ] => (
29 traits => [ qw/ XML::XSS::Role::StyleAttribute Clone/ ]
30 );
31  
32  
33 15 has process => (
34 traits => [ qw/ XML::XSS::Role::StyleAttribute Clone/ ]
35 );
36  
37 2 ▶sub clear {
Subroutine clear: called CC=2 SCAR=6.9
Pod undocumented
38 2 my $self = shift;
39  
40 2 for ( qw/ pre post replace filter process / ) {
41 10 my $setter = "clear_$_";
42 10 $self->$setter;
43 }
44  
45 }
46  
47 34 ▶sub apply {
Subroutine apply: called CC=7 SCAR=19.5
48 34 my ( $self, $node, $args ) = @_;
49 34 ▶ $args ||= {};
Condition50%1/2
$args ||= {}
l!l
340
MC/DC0%0/1
$args ||= {}
$args
Truth table50%1/2
A
A= $args
Aresult
11
00
50  
51 return
52 34 ▶ if $self->has_process and !$self->_render( 'process', $node, $args );
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_process and not $self->_render("process", $node, $args) 1 33 34
Condition66%2/3
$self->has_process and not $self->_render("process", $node, $args)
!ll&&!rl&&r
3301
MC/DC50%1/2
$self->has_process and not $self->_render("process", $node, $args)
$self->has_process not $self->_render("process", $node, $args)
Truth table66%2/3
A and not(B)
A= $self->has_processB= not $self->_render("process", $node, $args)
ABresult
0X0
100
111
53  
54 33 my $text = $node->data;
55  
56 33 my $output;
57 33 $output .= $self->_render( 'pre', $node, $args );
58  
59 33 ▶ if ( $self->has_replace ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->has_replace) 2 31 33
60 2 $text = $self->_render( 'replace', $node, $args );
61 }
62  
63 33 ▶ if ( $self->has_filter ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->has_filter) 2 31 33
64 2 $text = $self->filter->value()->() for $text; # quick alias to $_
65 }
66  
67 33 $output .= $text;
68 33 $output .= $self->_render( 'post', $node, $args );
69  
70 33 return $output;
71 }
72  
73 15 1;
74  
75 __END__
« XSS/Stylesheet/HTML2TD.pm ↑ Summary XSS/Role/StyleAttribute.pm »