line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Facebook::InstantArticle::Slideshow; |
2
|
1
|
|
|
1
|
|
570
|
use Moose; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
8
|
|
3
|
1
|
|
|
1
|
|
5929
|
use namespace::autoclean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
11
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
extends 'Facebook::InstantArticle::BaseElement'; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
81
|
use Facebook::InstantArticle::Figure::Image; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
253
|
|
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
|
505
|
my $self = shift; |
17
|
|
|
|
|
|
|
|
18
|
1
|
50
|
|
|
|
4
|
if ( my $e = Facebook::InstantArticle::Figure::Image->new(@_) ) { |
19
|
1
|
50
|
|
|
|
1893
|
if ( $e->is_valid ) { |
20
|
1
|
|
|
|
|
3
|
return push( @{$self->_images}, $e ); |
|
1
|
|
|
|
|
29
|
|
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
|
|
3
|
my $self = shift; |
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
|
|
4
|
my $gen = XML::Generator->new( ':pretty' ); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
return $gen->figure( |
51
|
|
|
|
|
|
|
{ class => 'op-slideshow' }, |
52
|
1
|
|
|
|
|
74
|
map { $_->as_xml_gen } @{ $self->_images }, |
|
1
|
|
|
|
|
27
|
|
|
1
|
|
|
|
|
37
|
|
53
|
|
|
|
|
|
|
); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |