blib/lib/Zabbix2/API/HostGroup.pm

filter: Statementstmt 61.9% 26 / 42 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 61.5% 8 / 13 Podpod 100% 2 / 2 totaltotal 50.7% 36 / 71 SCAR 23.8
CC
6
Cov
49%
_prefix
20.0
id
6.0
name
6.0
CRAP 10.8
« blib/lib/Zabbix2/API/Template.pm ↑ Summary blib/lib/Zabbix2/API/UserGroup.pm »
1 package Zabbix2::API::HostGroup;
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 Zabbix2::API::Host;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 ▶use Moo::Lax;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 extends qw/Zabbix2::API::CRUDE/;
15  
16 1 has 'hosts' => (is => 'ro',
17 lazy => 1,
18 builder => '_fetch_hosts');
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->{groupid} = $value;
25 0 return $self->data->{groupid};
26 } else {
27 0 return $self->data->{groupid};
28 }
29 }
30  
31 sub _prefix {
32 0 ▶ my (undef, $suffix) = @_;
Subroutine _prefix: not called CC=4 SCAR=30.0
33 0 ▶ if ($suffix and $suffix =~ m/ids?/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($suffix and $suffix =~ /ids?/) { } 0 0 0
elsif ($suffix) { } 0 0 0
Condition0%0/3
$suffix and $suffix =~ /ids?/
!ll&&!rl&&r
000
MC/DC0%0/2
$suffix and $suffix =~ /ids?/
$suffix $suffix =~ /ids?/
Truth table0%0/3
A and B
A= $suffixB= $suffix =~ /ids?/
ABresult
0X0
100
111
34 0 return 'group'.$suffix;
35 } elsif ($suffix) {
36 0 return 'hostgroup'.$suffix;
37 } else {
38 0 return 'hostgroup';
39 }
40 }
41  
42 sub _extension {
43 0 ▶ return (output => 'extend');
Subroutine _extension: not called CC=1 SCAR=6.9
44 }
45  
46 sub name {
47 0 ▶ my $self = shift;
Subroutine name: not called CC=2 SCAR=17.9
Pod documented
48 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
49 }
50  
51 sub _fetch_hosts {
52 0 ▶ my $self = shift;
Subroutine _fetch_hosts: not called CC=1 SCAR=6.9
53 0 my $hosts = $self->{root}->fetch('Host', params => { groupids => [ $self->id ] });
54 0 return $hosts;
55 }
56  
57 1 1;
58 __END__
« blib/lib/Zabbix2/API/Template.pm ↑ Summary blib/lib/Zabbix2/API/UserGroup.pm »