| 1 | package Zabbix2::API::UserGroup; | ||||||||||||||||||||||||||||||||
| 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 | ▶ | use Zabbix2::API::User; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||
| 15 | 1 | has 'users' => (is => 'ro', | |||||||||||||||||||||||||||||||
| 16 | lazy => 1, | ||||||||||||||||||||||||||||||||
| 17 | builder => '_fetch_users'); | ||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||
| 19 | sub id { | ||||||||||||||||||||||||||||||||
| 20 | ## mutator for id | ||||||||||||||||||||||||||||||||
| 21 | 0 | ▶ | my ($self, $value) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
id: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | if (defined $value) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 23 | 0 | $self->data->{usrgrpid} = $value; | |||||||||||||||||||||||||||||||
| 24 | 0 | return $self->data->{usrgrpid}; | |||||||||||||||||||||||||||||||
| 25 | } else { | ||||||||||||||||||||||||||||||||
| 26 | 0 | return $self->data->{usrgrpid}; | |||||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||
| 30 | sub _prefix { | ||||||||||||||||||||||||||||||||
| 31 | 0 | ▶ | my (undef, $suffix) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
_prefix: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||
| 32 | 0 | ▶ | if ($suffix and $suffix =~ m/ids?/) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$suffix and $suffix =~ /ids?/
MC/DC0%0/2
$suffix and $suffix =~ /ids?/
$suffix
$suffix =~ /ids?/
Truth table0%0/3
A and B
A= $suffixB= $suffix =~ /ids?/
| |||||||||||||||||||||||||||||||||
| 33 | 0 | return 'usrgrp'.$suffix; | |||||||||||||||||||||||||||||||
| 34 | } elsif ($suffix) { | ||||||||||||||||||||||||||||||||
| 35 | 0 | return 'usergroup'.$suffix; | |||||||||||||||||||||||||||||||
| 36 | } else { | ||||||||||||||||||||||||||||||||
| 37 | 0 | return 'usergroup'; | |||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||
| 41 | sub _extension { | ||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | return (output => 'extend'); | ||||||||||||||||||||||||||||||
|
Subroutine
_extension: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||
| 45 | sub name { | ||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
name: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | return $self->data->{name} || '???'; | ||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->data->{'name'} || '???'
MC/DC0%0/1
$self->data->{'name'} || '???'
$self->data->{'name'}
Truth table0%0/2
A
A= $self->data->{'name'}
| |||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||
| 50 | sub _fetch_users { | ||||||||||||||||||||||||||||||||
| 51 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
_fetch_users: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 52 | 0 | my $users = $self->{root}->fetch('User', params => { usrgrpids => [ $self->id ] }); | |||||||||||||||||||||||||||||||
| 53 | 0 | return $users; | |||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||
| 56 | 1 | 1; | |||||||||||||||||||||||||||||||
| 57 | __END__ | ||||||||||||||||||||||||||||||||