API/Builder/ImagemapMessage.pm

filter: Statementstmt 93.3% 28 / 30 Branchbran 75.0% 3 / 4 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 5 totaltotal 79.5% 39 / 49 CC 7 SCAR 15.1
CC
7
Cov
89%
new
7.5
BEGIN
1.0
BEGIN
1.0
CRAP 4.5
↑ Summary API/Builder/FlexMessage.pm »
1 package LINE::Bot::API::Builder::ImagemapMessage;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 2 ▶sub new {
Subroutine new: called CC=7 SCAR=20.2
Pod undocumented
6 2 my($class, %args) = @_;
7 my %o = (
8 type => 'imagemap',
9 baseUrl => $args{base_url},
10 altText => $args{alt_text},
11 baseSize => +{
12 width => $args{base_width},
13 height => $args{base_height},
14 },
15 2 ▶ actions => $args{actions} // [],
Condition50%1/2
$args{"actions"} // []
l!l
02
MC/DC0%0/1
$args{"actions"} // []
$args{"actions"}
Truth table50%1/2
A
A= $args{"actions"}
Aresult
11
00
16 );
17  
18 2 ▶ if ($args{video}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args{"video"}) 1 1 2
19 1 $o{video} = {};
20 1 for my $attr (qw(originalContentUrl previewImageUrl)) {
21 2 $o{video}{$attr} = $args{video}{$attr};
22 }
23 1 for my $attr (qw(x y width height)) {
24 4 $o{video}{area}{$attr} = $args{video}{area}{$attr};
25 }
26  
27 1 ▶ if ($args{video}{externalLink}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args{"video"}{"externalLink"}) 0 1 1
28 0 for my $attr (qw(label linkUri)) {
29 0 $o{video}{externalLink}{$attr} = $args{video}{externalLink}{$attr};
30 }
31 }
32 }
33  
34 2 return bless \%o, $class;
35 }
36  
37 2 ▶sub build {
Subroutine build: called CC=1 SCAR=0.0
Pod undocumented
38 2 my($self, ) = @_;
39 2 +{ %{ $self } };
40 }
41  
42 2 ▶sub add_action {
Subroutine add_action: called CC=1 SCAR=0.0
Pod undocumented
43 2 my($self, $action) = @_;
44 2 push @{ $self->{actions} }, $action;
45 2 $self;
46 }
47  
48 1 ▶sub add_uri_action {
Subroutine add_uri_action: called CC=1 SCAR=0.0
Pod undocumented
49 1 my($self, %args) = @_;
50 $self->add_action(+{
51 type => 'uri',
52 linkUri => $args{uri},
53 area => +{
54 x => $args{area_x},
55 y => $args{area_y},
56 width => $args{area_width},
57 height => $args{area_height},
58 },
59 1 });
60 }
61  
62 1 ▶sub add_message_action {
Subroutine add_message_action: called CC=1 SCAR=0.0
Pod undocumented
63 1 my($self, %args) = @_;
64 $self->add_action(+{
65 type => 'message',
66 text => $args{text},
67 area => +{
68 x => $args{area_x},
69 y => $args{area_y},
70 width => $args{area_width},
71 height => $args{area_height},
72 },
73 1 });
74 }
75  
76 1 1;
↑ Summary API/Builder/FlexMessage.pm »