Tag/ENT.pm

filter: Statementstmt 78.1% 25 / 32 Branchbran 37.5% 3 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 90.0% 9 / 10 Podpod 100% 6 / 6 totaltotal 76.7% 43 / 56 CC 5 SCAR 8.8
CC
5
Cov
70%
toText
6.0
validateParam
3.4
toHTML
2.1
CRAP 2.4
« Tag/xURL.pm ↑ Summary Tag/Simple.pm »
1 # $Id: ENT.pm 284 2006-12-01 07:51:49Z chronos $
2 package BBCode::Tag::ENT;
3 1 ▶use base qw(BBCode::Tag);
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use BBCode::Util qw(:parse decodeHTML);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 our $VERSION = '0.34';
8  
9 2 ▶sub Class($):method {
Subroutine Class: called CC=1 SCAR=0.0
Pod documented
10 2 return qw(TEXT INLINE);
11 }
12  
13 2 ▶sub NamedParams($):method {
Subroutine NamedParams: called CC=1 SCAR=0.0
Pod documented
14 2 return qw(VAL);
15 }
16  
17 2 ▶sub DefaultParam($):method {
Subroutine DefaultParam: called CC=1 SCAR=0.0
Pod documented
18 2 return 'VAL';
19 }
20  
21 1 ▶sub validateParam($$$):method {
Subroutine validateParam: called CC=3 SCAR=12.3
Pod documented
22 1 my($this,$param,$val) = @_;
23 1 ▶ if($param eq 'VAL') {
Branch: 1 branch
BranchTrueFalseTotal
if ($param eq "VAL") 1 0 1
24 1 my $ent = parseEntity($val);
25 1 ▶ if(defined $ent) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ent) { } 1 0 1
26 1 return $ent;
27 } else {
28 0 die qq(Invalid value "$val" for [ENT]);
29 }
30 }
31 0 return $this->SUPER::validateParam($param,$val);
32 }
33  
34 1 ▶sub toHTML($):method {
Subroutine toHTML: called CC=2 SCAR=7.6
Pod documented
35 1 my $this = shift;
36 1 my $ent = $this->param('VAL');
37 1 ▶ return "&$ent;" if defined $ent;
Branch: 1 branch
BranchTrueFalseTotal
if defined $ent 1 0 1
38 0 return "";
39 }
40  
41 0 ▶sub toText($):method {
Subroutine toText: not called CC=2 SCAR=17.9
Pod documented
42 0 my $this = shift;
43 0 my $ent = $this->param('VAL');
44 0 ▶ return decodeHTML("&$ent;") if defined $ent;
Branch: 1 branch
BranchTrueFalseTotal
if defined $ent 0 0 0
45 0 return "";
46 }
47  
48 1 1;
« Tag/xURL.pm ↑ Summary Tag/Simple.pm »