line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Facebook::InstantArticle::Slideshow; |
2
|
1
|
|
|
1
|
|
696
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
3
|
1
|
|
|
1
|
|
7902
|
use namespace::autoclean; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
15
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
extends 'Facebook::InstantArticle::BaseElement'; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
131
|
use Facebook::InstantArticle::Figure::Image; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
425
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has '_images' => ( |
10
|
|
|
|
|
|
|
isa => 'ArrayRef[Facebook::InstantArticle::Figure::Image]', |
11
|
|
|
|
|
|
|
is => 'ro', |
12
|
|
|
|
|
|
|
default => sub { [] }, |
13
|
|
|
|
|
|
|
); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub add_image { |
16
|
1
|
|
|
1
|
0
|
461
|
my $self = shift; |
17
|
|
|
|
|
|
|
|
18
|
1
|
50
|
|
|
|
4
|
if ( my $e = Facebook::InstantArticle::Figure::Image->new(@_) ) { |
19
|
1
|
50
|
|
|
|
1779
|
if ( $e->is_valid ) { |
20
|
1
|
|
|
|
|
3
|
return push( @{$self->_images}, $e ); |
|
1
|
|
|
|
|
36
|
|
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
0
|
$self->_log->warn( 'Failed to add image to slideshow!' ); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
has 'is_valid' => ( |
28
|
|
|
|
|
|
|
isa => 'Bool', |
29
|
|
|
|
|
|
|
is => 'ro', |
30
|
|
|
|
|
|
|
lazy => 1, |
31
|
|
|
|
|
|
|
default => sub { |
32
|
|
|
|
|
|
|
my $self = shift; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
return scalar( @{$self->_images} ) ? 1 : 0; |
35
|
|
|
|
|
|
|
}, |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
has 'as_xml_gen' => ( |
39
|
|
|
|
|
|
|
isa => 'Object', |
40
|
|
|
|
|
|
|
is => 'ro', |
41
|
|
|
|
|
|
|
lazy => 1, |
42
|
|
|
|
|
|
|
builder => '_build_as_xml_gen', |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub _build_as_xml_gen { |
46
|
1
|
|
|
1
|
|
7
|
my $self = shift; |
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
|
|
5
|
my $gen = XML::Generator->new( ':pretty' ); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
return $gen->figure( |
51
|
|
|
|
|
|
|
{ class => 'op-slideshow' }, |
52
|
1
|
|
|
|
|
96
|
map { $_->as_xml_gen } @{ $self->_images }, |
|
1
|
|
|
|
|
64
|
|
|
1
|
|
|
|
|
94
|
|
53
|
|
|
|
|
|
|
); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |