InstantArticle/Paragraph.pm

filter: Statementstmt 95.4% 21 / 22 Branchbran 75.0% 3 / 4 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 83.3% 30 / 36 SCAR 14.0
CC
4
Cov
86%
__ANON__
3.6
__ANON__
2.0
BEGIN
1.0
CRAP 4.0
« InstantArticle/Copyright.pm ↑ Summary InstantArticle/Slideshow.pm »
1 package Facebook::InstantArticle::Paragraph;
2 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 2 extends 'Facebook::InstantArticle::BaseElement';
6  
7 2 has 'text' => (
8 isa => 'Str',
9 is => 'rw',
10 required => 1,
11 default => '',
12 );
13  
14 around BUILDARGS => sub {
15 4 ▶ my $orig = shift;
Subroutine __ANON__: called CC=3 SCAR=12.7
16 4 my $class = shift;
17  
18 4 ▶ if ( @_ == 1 && !ref $_[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 1 and not ref $_[0]) { } 4 0 4
Condition33%1/3
@_ == 1 and not ref $_[0]
!ll&&!rl&&r
004
MC/DC0%0/2
@_ == 1 and not ref $_[0]
@_ == 1 not ref $_[0]
Truth table33%1/3
A and not(B)
A= @_ == 1B= not ref $_[0]
ABresult
0X0
100
111
19 4 return $class->$orig( text => $_[0] );
20 }
21 else {
22 0 return $class->$orig( @_ );
23 }
24 2 };
25  
26 has 'is_valid' => (
27 isa => 'Bool',
28 is => 'ro',
29 lazy => 1,
30 default => sub {
31 4 ▶ my $self = shift;
Subroutine __ANON__: called CC=2 SCAR=6.9
32  
33 4 ▶ return length $self->squeeze( $self->text ) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
length $self->squeeze($self->text) ? : 3 1 4
34 },
35 2 );
36  
37 2 has 'as_xml_gen' => (
38 isa => 'Object',
39 is => 'ro',
40 lazy => 1,
41 builder => '_build_as_xml_gen',
42 );
43  
44 sub _build_as_xml_gen {
45 3 ▶ my $self = shift;
Subroutine _build_as_xml_gen: called CC=1 SCAR=0.0
46  
47 3 my $gen = XML::Generator->new( ':pretty' );
48  
49 3 return $gen->p(
50 \$self->text,
51 );
52 }
53  
54 2 1;
« InstantArticle/Copyright.pm ↑ Summary InstantArticle/Slideshow.pm »