| 1 | package Facebook::InstantArticle::Heading; | ||||||||||||||||||||||||||||||||||||||||||
| 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 'level' => ( | |||||||||||||||||||||||||||||||||||||||||
| 8 | isa => 'Int', | ||||||||||||||||||||||||||||||||||||||||||
| 9 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 10 | required => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 11 | default => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 12 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 2 | has 'text' => ( | |||||||||||||||||||||||||||||||||||||||||
| 15 | isa => 'Str', | ||||||||||||||||||||||||||||||||||||||||||
| 16 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 17 | required => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 18 | default => '', | ||||||||||||||||||||||||||||||||||||||||||
| 19 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | has 'is_valid' => ( | ||||||||||||||||||||||||||||||||||||||||||
| 22 | isa => 'Bool', | ||||||||||||||||||||||||||||||||||||||||||
| 23 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||
| 24 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 25 | default => sub { | ||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | ▶ | return (length $self->text && $self->level > 1 && $self->level < 7) ? 1 :0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
length $self->text and $self->level > 1 and $self->level < 7
length $self->text and $self->level > 1
MC/DC0%0/3
length $self->text and $self->level > 1 and $self->level < 7
length $self->text
$self->level > 1
$self->level < 7
Truth table0%0/4
A and B and C
A= length $self->textB= $self->level > 1C= $self->level < 7
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 30 | 2 | ); | |||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | 2 | has 'as_xml_gen' => ( | |||||||||||||||||||||||||||||||||||||||||
| 33 | isa => 'Object', | ||||||||||||||||||||||||||||||||||||||||||
| 34 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||
| 35 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 36 | builder => '_build_as_xml_gen', | ||||||||||||||||||||||||||||||||||||||||||
| 37 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | sub _build_as_xml_gen { | ||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_as_xml_gen: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | my $gen = XML::Generator->new( ':pretty' ); | |||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | if ( $self->level == 1 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | return $gen->h1( | |||||||||||||||||||||||||||||||||||||||||
| 46 | \$self->text, | ||||||||||||||||||||||||||||||||||||||||||
| 47 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||
| 49 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | return $gen->h2( | |||||||||||||||||||||||||||||||||||||||||
| 51 | \$self->text, | ||||||||||||||||||||||||||||||||||||||||||
| 52 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||