| 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
Condition33%1/3
@_ == 1 and not ref $_[0]
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]
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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; | |||||||||||||||||||||||||||