lib/Mojolicious/Plugin/JsonRpcDispatcher.pm

filter: Statementstmt 93.3% 14 / 15 Branchbran 83.3% 5 / 6 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 3 / 3 Podpod 100% 1 / 1 totaltotal 80.0% 24 / 30 CC 5 SCAR 14.1
CC
5
Cov
83%
register
5.3
BEGIN
1.0
BEGIN
1.0
CRAP 4.1
« lib/MojoX/JSON/RPC/Service.pm ↑ Summary blib/lib/MojoX/JSON/RPC.pm »
1 package Mojolicious::Plugin::JsonRpcDispatcher;
2  
3 3 ▶use Mojo::Base 'Mojolicious::Plugin';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use MojoX::JSON::RPC::Dispatcher;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 ▶sub register {
Subroutine register: called CC=5 SCAR=16.7
Pod documented
7 3 my ( $self, $app, $conf ) = @_;
8  
9 3 my $r = $app->routes;
10 3 ▶ if ( exists $conf->{services} && ref $conf->{services} eq 'HASH' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $conf->{'services'} and ref $conf->{'services'} eq 'HASH') { } 3 0 3
Condition33%1/3
exists $conf->{"services"} and ref $conf->{"services"} eq "HASH"
!ll&&!rl&&r
003
MC/DC0%0/2
exists $conf->{"services"} and ref $conf->{"services"} eq "HASH"
exists $conf->{"services"} ref $conf->{"services"} eq "HASH"
Truth table33%1/3
A and B
A= exists $conf->{"services"}B= ref $conf->{"services"} eq "HASH"
ABresult
0X0
100
111
11 SVC:
12 3 ▶ while ( my ( $path, $svc ) = each %{ $conf->{services} } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %{$$conf{"services"};}) 4 3 7
13 $r->any($path)->to(
14 'Dispatcher#call',
15 service => $svc,
16 namespace => 'MojoX::JSON::RPC',
17 exists $conf->{exception_handler}
18 ? ( exception_handler => $conf->{exception_handler} )
19 4 ▶ : ()
Branch: 1 branch
BranchTrueFalseTotal
exists $conf->{'exception_handler'} ? : 1 3 4
20 );
21 }
22 }
23 else {
24 0 Carp::confess 'No services found!';
25 }
26 3 return;
27 }
28  
29 3 1;
30  
31 __END__
« lib/MojoX/JSON/RPC/Service.pm ↑ Summary blib/lib/MojoX/JSON/RPC.pm »