InstantArticle/Map.pm

filter: Statementstmt 100% 18 / 18 Branchbran 50.0% 1 / 2 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 82.7% 24 / 29 SCAR 11.1
CC
3
Cov
87%
__ANON__
3.7
BEGIN
1.0
BEGIN
1.0
CRAP 3.0
« InstantArticle/Slideshow.pm ↑ Summary InstantArticle/List.pm »
1 package Facebook::InstantArticle::Map;
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 'type' => (
8 isa => 'Str',
9 is => 'rw',
10 required => 0,
11 default => 'Point',
12 );
13  
14 2 has 'latitude' => (
15 isa => 'Maybe[Num]',
16 is => 'rw',
17 required => 1,
18 default => 0,
19 );
20  
21 2 has 'longitude' => (
22 isa => 'Maybe[Num]',
23 is => 'rw',
24 required => 1,
25 default => 0,
26 );
27  
28 has 'is_valid' => (
29 isa => 'Bool',
30 is => 'ro',
31 lazy => 1,
32 default => sub {
33 1 ▶ my $self = shift;
Subroutine __ANON__: called CC=3 SCAR=13.1
34  
35 1 ▶ return ( defined $self->latitude && defined $self->longitude ) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
defined $self->latitude && defined $self->longitude ? : 1 0 1
Condition33%1/3
defined $self->latitude and defined $self->longitude
!ll&&!rl&&r
001
MC/DC0%0/2
defined $self->latitude and defined $self->longitude
defined $self->latitude defined $self->longitude
Truth table33%1/3
A and B
A= defined $self->latitudeB= defined $self->longitude
ABresult
0X0
100
111
36 },
37 2 );
38  
39 2 has 'as_xml_gen' => (
40 isa => 'Object',
41 is => 'ro',
42 lazy => 1,
43 builder => '_build_as_xml_gen',
44 );
45  
46 sub _build_as_xml_gen {
47 1 ▶ my $self = shift;
Subroutine _build_as_xml_gen: called CC=1 SCAR=0.0
48  
49 1 my $gen = XML::Generator->new( ':pretty' );
50  
51 1 return $gen->figure(
52 { class => 'op-map' },
53 $gen->script(
54 { type => 'application/json', class => 'op-geotag' },
55 '{
56 "type": "Feature",
57 "geometry":
58 {
59 "type": "' . $self->type . '",
60 "coordinates": [' . $self->latitude . ', ' . $self->longitude . ']
61 },
62 "properties":
63 {
64 "title": "",
65 "radius": 350000,
66 "pivot": true,
67 "style": "satellite",
68 }
69 }',
70 ),
71 );
72 }
73  
74 2 1;
« InstantArticle/Slideshow.pm ↑ Summary InstantArticle/List.pm »