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   887 use strict;
  2         13  
  2         60  
11 2     2   10 use warnings;
  2         5  
  2         351  
12              
13             sub _parse_tls_verification {
14 7     7   23 my ( $self, $opts_hr ) = @_;
15              
16 7 100       20 if ( exists $opts_hr->{'tls_verification'} ) {
17 6         17 my $tls_verification = delete $opts_hr->{'tls_verification'};
18              
19 6 50       14 if ( !grep { $_ eq $tls_verification } qw( on off ) ) {
  12         45  
20 0         0 die "Bad “tls_verification”: $tls_verification";
21             }
22              
23 6         22 $self->{'tls_verification'} = $tls_verification;
24             }
25              
26 7         31 return $self->_get_tls_verification();
27             }
28              
29             sub _get_tls_verification {
30 7     7   32 my ($self) = @_;
31              
32 7   100     41 return $self->{'tls_verification'} || 'on';
33             }
34              
35             1;