Twilio.pm

filter: Statementstmt 100% 15 / 15 Branchbran 100% 2 / 2 Conditioncond 83.3% 5 / 6 MC/DCmcdc 66.6% 2 / 3 Subroutinesub 100% 3 / 3 Podpod 100% 1 / 1 totaltotal 93.3% 28 / 30 CC 4 SCAR 11.0
CC
4
Cov
96%
new
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.0
« Twilio/AuthStrategy/TokenAuthStrategy.pm ↑ Summary Twilio/CredentialProvider/ClientCredentialProvider.pm »
1 package Twilio;
2  
3 20 ▶use 5.016;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 20 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 20 our $VERSION = '2.001';
7  
8 # 1.x took named arguments; passed to the 2.x constructor they would become the
9 # credentials and fail only at the first request, as a 401 from Twilio.
10 20 my %IS_V1_ARGUMENT = map { $_ => 1 } qw(sid token trace debug use_threads);
11  
12 # The client is loaded here, not at compile time, so that "use Twilio" stays cheap.
13 24 ▶sub new {
Subroutine new: called CC=4 SCAR=13.9
Pod documented
14 24 my ($class, @arguments) = @_;
15 24 ▶ if (@arguments && defined $arguments[0] && $IS_V1_ARGUMENT{ $arguments[0] }) {
Branch: 1 branch
BranchTrueFalseTotal
if (@arguments and defined $arguments[0] and $IS_V1_ARGUMENT{$arguments[0]}) 5 19 24
Condition83%5/6
@arguments and defined $arguments[0] and $IS_V1_ARGUMENT{$arguments[0]}
!ll&&!rl&&r
2175
@arguments and defined $arguments[0]
!ll&&!rl&&r
2022
MC/DC66%2/3
@arguments and defined $arguments[0] and $IS_V1_ARGUMENT{$arguments[0]}
@arguments defined $arguments[0] $IS_V1_ARGUMENT{$arguments[0]}
Truth table75%3/4
A and B and C
A= @argumentsB= defined $arguments[0]C= $IS_V1_ARGUMENT{$arguments[0]}
ABCresult
0XX0
10X0
1100
1111
16 5 require Twilio::Exceptions::ConfigurationException;
17 5 Twilio::Exceptions::ConfigurationException->throw(
18 "Twilio->new($arguments[0] => ...) is the 1.x interface; "
19 . 'since 2.0 it takes ($username, $password, \%options), like Twilio::Rest::Client->new');
20 }
21 19 require Twilio::Rest::Client;
22 19 return Twilio::Rest::Client->new(@arguments);
23 }
24  
25 20 1;
26  
27 __END__
« Twilio/AuthStrategy/TokenAuthStrategy.pm ↑ Summary Twilio/CredentialProvider/ClientCredentialProvider.pm »