lib/HTML/FormFu/Filter/HTMLScrubber.pm

filter: Statementstmt 88.8% 32 / 36 Branchbran 50.0% 3 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod 0.0% 0 / 2 totaltotal 80.3% 41 / 51 CC 5 SCAR 11.0
CC
5
Cov
83%
clone
6.0
filter
4.0
BEGIN
1.0
CRAP 3.0
« lib/HTML/FormFu/Exception/Transformer.pm ↑ Summary lib/HTML/FormFu/QueryType/CGI.pm »
1 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2  
3 package HTML::FormFu::Filter::HTMLScrubber;
4 4 $HTML::FormFu::Filter::HTMLScrubber::VERSION = '2.09';
5 # ABSTRACT: filter removing HTML markup
6  
7 4 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 ▶use MooseX::Attribute::Chained;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 4 extends 'HTML::FormFu::Filter';
10  
11 4 ▶use Clone ();
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 4 has allow => ( is => 'rw', traits => ['Chained'] );
14 4 has comment => ( is => 'rw', traits => ['Chained'] );
15 4 has default => ( is => 'rw', traits => ['Chained'] );
16 4 has rules => ( is => 'rw', traits => ['Chained'] );
17 4 has script => ( is => 'rw', traits => ['Chained'] );
18  
19 4 ▶use HTML::Scrubber;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 3 ▶sub filter {
Subroutine filter: called CC=4 SCAR=13.9
Pod undocumented
22 3 my ( $self, $value ) = @_;
23  
24 3 ▶ return if !defined $value;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 0 3 3
25  
26 3 my %params = ( allow => 0 );
27 3 foreach (qw(allow comment default rules script)) {
28 15 my $val = $self->$_;
29 15 ▶ $params{$_} = $val if ( defined($val) );
Branch: 1 branch
BranchTrueFalseTotal
if defined $val 2 13 15
30 }
31  
32 3 my $scrubber = HTML::Scrubber->new(%params);
33  
34 3 return $scrubber->scrub($value);
35 }
36  
37 0 ▶sub clone {
Subroutine clone: not called CC=2 SCAR=17.9
Pod undocumented
38 0 my $self = shift;
39  
40 0 my $clone = $self->SUPER::clone(@_);
41  
42 0 ▶ $clone->allow( Clone::clone $self->allow )
Branch: 1 branch
BranchTrueFalseTotal
if ref $self->allow 0 0 0
43 if ref $self->allow;
44  
45 0 return $clone;
46 }
47  
48 4 __PACKAGE__->meta->make_immutable;
49  
50 4 1;
51  
52 __END__
« lib/HTML/FormFu/Exception/Transformer.pm ↑ Summary lib/HTML/FormFu/QueryType/CGI.pm »