blib/lib/Zabbix2/API/Application.pm

filter: Statementstmt 54.3% 25 / 46 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 46.6% 7 / 15 Podpod 100% 2 / 2 totaltotal 48.5% 34 / 70 SCAR 18.3
CC
4
Cov
48%
id
6.0
_prefix
6.0
name
6.0
CRAP 6.2
« blib/lib/Zabbix2/API/Host.pm ↑ Summary blib/lib/Zabbix2/API/Map.pm »
1 package Zabbix2::API::Application;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use autodie;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use Moo::Lax;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 extends qw/Zabbix2::API::CRUDE/;
12  
13 1 has 'items' => (is => 'ro',
14 lazy => 1,
15 builder => '_fetch_items');
16 1 has 'host' => (is => 'ro',
17 lazy => 1,
18 builder => '_fetch_host');
19  
20 sub id {
21 ## mutator for id
22 0 ▶ my ($self, $value) = @_;
Subroutine id: not called CC=2 SCAR=17.9
Pod documented
23 0 ▶ if (defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) { } 0 0 0
24 0 $self->data->{applicationid} = $value;
25 0 return $self->data->{applicationid};
26 } else {
27 0 return $self->data->{applicationid};
28 }
29 }
30  
31 sub _readonly_properties {
32 return {
33 0 ▶ applicationid => 1,
Subroutine _readonly_properties: not called CC=1 SCAR=6.9
34 # 2.2 uses templateids, 2.0 uses templateid, neither are updatable
35 templateids => 1,
36 templateid => 1,
37 };
38 }
39  
40 sub _prefix {
41 0 ▶ my (undef, $suffix) = @_;
Subroutine _prefix: not called CC=2 SCAR=17.9
42 0 ▶ if ($suffix) {
Branch: 1 branch
BranchTrueFalseTotal
if ($suffix) { } 0 0 0
43 0 return 'application'.$suffix;
44 } else {
45 0 return 'application';
46 }
47 }
48  
49 sub _extension {
50 0 ▶ return (output => 'extend');
Subroutine _extension: not called CC=1 SCAR=6.9
51 }
52  
53 sub name {
54 0 ▶ my $self = shift;
Subroutine name: not called CC=2 SCAR=17.9
Pod documented
55 0 ▶ return $self->data->{name} || '???';
Condition0%0/2
$self->data->{'name'} || '???'
l!l
00
MC/DC0%0/1
$self->data->{'name'} || '???'
$self->data->{'name'}
Truth table0%0/2
A
A= $self->data->{'name'}
Aresult
11
00
56 }
57  
58 sub _fetch_items {
59 0 ▶ my $self = shift;
Subroutine _fetch_items: not called CC=1 SCAR=6.9
60 0 my $items = $self->{root}->fetch('Item', params => { applicationids => [ $self->id ] });
61 0 return $items;
62 }
63  
64 sub _fetch_host {
65 0 ▶ my $self = shift;
Subroutine _fetch_host: not called CC=1 SCAR=6.9
66 0 my $host = $self->{root}->fetch_single('Host', params => { hostids => [ $self->data->{hostid} ] });
67 0 return $host;
68 }
69  
70 before 'update' => sub {
71 # you can create an Application with a hostid, but you can never
72 # update it
73 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
74 0 delete $self->data->{hostid};
75 1 };
76  
77 1 1;
78 __END__
« blib/lib/Zabbix2/API/Host.pm ↑ Summary blib/lib/Zabbix2/API/Map.pm »