Elemental/Element.pm

filter: Statementstmt 100% 25 / 25 Branchbran 58.3% 7 / 12 Conditioncond 50.0% 2 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 8 / 8 Podpod 100% 6 / 6 totaltotal 84.2% 48 / 57 CC 9 SCAR 9.1
CC
9
Cov
83%
contents
3.2
attributes
3.2
text_content
3.0
CRAP 2.5
« Elemental/SAXHandler.pm ↑ Summary Elemental/Document.pm »
1 package XML::Elemental::Element;
2 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use base qw( XML::Elemental::Node );
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 17 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
6 17 my $self = bless {}, $_[0];
7 17 $self->{attribute} = {};
8 17 $self->{contents} = [];
9 17 return $self;
10 }
11  
12 3 ▶sub text_content {
Subroutine text_content: called CC=3 SCAR=11.0
Pod documented
13 3 ▶ return '' unless defined $_[0]->{contents};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $_[0]{"contents"} 0 3 3
14 return join('',
15 5 ▶ map { $_->can('text_content') ? $_->text_content : $_->data }
Branch: 1 branch
BranchTrueFalseTotal
$_->can('text_content') ? : 1 4 5
16 3 @{$_[0]->contents});
17 }
18  
19 11 ▶sub name {
Subroutine name: called CC=2 SCAR=7.2
Pod documented
20 11 ▶ $_[0]->{name} = $_[1] if @_ > 1;
Branch: 1 branch
BranchTrueFalseTotal
if @_ > 1 0 11 11
21 11 return $_[0]->{name};
22 }
23  
24 3 ▶sub parent {
Subroutine parent: called CC=2 SCAR=7.2
Pod documented
25 3 ▶ $_[0]->{parent} = $_[1] if @_ > 1;
Branch: 1 branch
BranchTrueFalseTotal
if @_ > 1 0 3 3
26 3 return $_[0]->{parent};
27 }
28  
29 8 ▶sub contents {
Subroutine contents: called CC=3 SCAR=11.7
Pod documented
30 8 ▶ $_[0]->{contents} ||= [];
Condition50%1/2
$_[0]{"contents"} ||= []
l!l
80
MC/DC0%0/1
$_[0]{"contents"} ||= []
$_[0]{"contents"}
Truth table50%1/2
A
A= $_[0]{"contents"}
Aresult
11
00
31 8 ▶ $_[0]->{contents} = $_[1] if @_ > 1;
Branch: 1 branch
BranchTrueFalseTotal
if @_ > 1 0 8 8
32 8 return $_[0]->{contents};
33 }
34  
35 2 ▶sub attributes {
Subroutine attributes: called CC=3 SCAR=11.7
Pod documented
36 2 ▶ $_[0]->{attributes} ||= {};
Condition50%1/2
$_[0]{"attributes"} ||= {}
l!l
20
MC/DC0%0/1
$_[0]{"attributes"} ||= {}
$_[0]{"attributes"}
Truth table50%1/2
A
A= $_[0]{"attributes"}
Aresult
11
00
37 2 ▶ $_[0]->{attributes} = $_[1] if @_ > 1;
Branch: 1 branch
BranchTrueFalseTotal
if @_ > 1 0 2 2
38 2 return $_[0]->{attributes};
39 }
40  
41 3 1;
42  
43 __END__
« Elemental/SAXHandler.pm ↑ Summary Elemental/Document.pm »