File Coverage

blib/lib/cPanel/APIClient/TransportBase/TLSVerificationBase.pm
Criterion Covered Total %
statement 15 16 93.7
branch 3 4 75.0
condition 2 2 100.0
subroutine 4 4 100.0
pod n/a
total 24 26 92.3


line stmt bran cond sub pod time code
1             package cPanel::APIClient::TransportBase::TLSVerificationBase;
2              
3             # Copyright 2020 cPanel, L. L. C.
4             # All rights reserved.
5             # http://cpanel.net
6             #
7             # This is free software; you can redistribute it and/or modify it under the
8             # same terms as Perl itself. See L.
9              
10 2     2   907 use strict;
  2         4  
  2         58  
11 2     2   10 use warnings;
  2         17  
  2         388  
12              
13             sub _parse_tls_verification {
14 7     7   22 my ( $self, $opts_hr ) = @_;
15              
16 7 100       25 if ( exists $opts_hr->{'tls_verification'} ) {
17 6         16 my $tls_verification = delete $opts_hr->{'tls_verification'};
18              
19 6 50       16 if ( !grep { $_ eq $tls_verification } qw( on off ) ) {
  12         55  
20 0         0 die "Bad “tls_verification”: $tls_verification";
21             }
22              
23 6         25 $self->{'tls_verification'} = $tls_verification;
24             }
25              
26 7         23 return $self->_get_tls_verification();
27             }
28              
29             sub _get_tls_verification {
30 7     7   50 my ($self) = @_;
31              
32 7   100     42 return $self->{'tls_verification'} || 'on';
33             }
34              
35             1;