InstantArticle/Copyright.pm

filter: Statementstmt 95.4% 21 / 22 Branchbran 50.0% 2 / 4 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 80.5% 29 / 36 SCAR 14.1
CC
4
Cov
83%
__ANON__
3.6
__ANON__
2.1
BEGIN
1.0
CRAP 4.1
« InstantArticle/Blockquote.pm ↑ Summary InstantArticle/Paragraph.pm »
1 package Facebook::InstantArticle::Copyright;
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 1 ▶ my $orig = shift;
Subroutine __ANON__: called CC=3 SCAR=12.7
16 1 my $class = shift;
17  
18 1 ▶ if ( @_ == 1 && !ref $_[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 1 and not ref $_[0]) { } 1 0 1
Condition33%1/3
@_ == 1 and not ref $_[0]
!ll&&!rl&&r
001
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 1 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 1 ▶ my $self = shift;
Subroutine __ANON__: called CC=2 SCAR=7.2
32  
33 1 ▶ return length $self->text ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
length $self->text ? : 1 0 1
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 1 ▶ my $self = shift;
Subroutine _build_as_xml_gen: called CC=1 SCAR=0.0
46  
47 1 my $gen = XML::Generator->new( ':pretty' );
48  
49 1 return $gen->small(
50 \$self->text,
51 );
52 }
53  
54 2 1;
« InstantArticle/Blockquote.pm ↑ Summary InstantArticle/Paragraph.pm »