CatalystX/OAuth2/Controller/Role/WithStore.pm

filter: Statementstmt 100% 20 / 20 Branchbran 50.0% 4 / 8 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 77.1% 27 / 35 SCAR 20.0
CC
7
Cov
81%
__ANON__
7.7
BEGIN
1.0
CRAP 7.4
« CatalystX/OAuth2/Request/RequestAuth.pm ↑ Summary CatalystX/OAuth2/Request/GrantAuth.pm »
1 package CatalystX::OAuth2::Controller::Role::WithStore;
2 10 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 # ABSTRACT: A role for providing oauth2 stores to controllers
5  
6 10 has store => (
7 does => 'CatalystX::OAuth2::Store',
8 is => 'ro',
9 required => 1
10 );
11  
12 around BUILDARGS => sub {
13 41 ▶ my $orig = shift;
Subroutine __ANON__: called CC=7 SCAR=20.4
14 41 my $self = shift;
15 41 my $args = $self->$orig(@_);
16 41 ▶ return $args unless @_ == 2;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 41 41
17 41 my ($app) = @_;
18 41 for ( $args->{store} ) {
19 41 ▶ last unless defined and ref eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless defined $_ and ref $_ eq "HASH" 0 41 41
Condition33%1/3
defined $_ and ref $_ eq "HASH"
!ll&&!rl&&r
0041
MC/DC0%0/2
defined $_ and ref $_ eq "HASH"
defined $_ ref $_ eq "HASH"
Truth table33%1/3
A and B
A= defined $_B= ref $_ eq "HASH"
ABresult
0X0
100
111
20 41 my $store_args = {%$_};
21 41 my $class = delete $store_args->{class};
22 41 ▶ $class = "CatalystX::OAuth2::Store::$class" unless $class =~ /^\+/;
Branch: 1 branch
BranchTrueFalseTotal
unless $class =~ /^\+/ 41 0 41
23 41 my ( $is_success, $error ) = Class::Load::try_load_class($class);
24 41 ▶ die qq{Couldn't load OAuth2 store '$class': $error} unless $is_success;
Branch: 1 branch
BranchTrueFalseTotal
unless $is_success 0 41 41
25 41 $args->{store} = $class->new( %$store_args, app => $app );
26 }
27 41 return $args;
28 10 };
29  
30 10 1;
31  
32 __END__
33  
34 =pod
35  
36 =head1 NAME
37  
38 CatalystX::OAuth2::Controller::Role::WithStore - A role for providing oauth2 stores to controllers
39  
40 =head1 VERSION
41  
42 version 0.001006
43  
44 =head1 AUTHOR
45  
46 Eden Cardim <edencardim@gmail.com>
47  
48 =head1 COPYRIGHT AND LICENSE
49  
50 This software is copyright (c) 2017 by Suretec Systems Ltd.
51  
52 This is free software; you can redistribute it and/or modify it under
53 the same terms as the Perl 5 programming language system itself.
54  
55 =cut
« CatalystX/OAuth2/Request/RequestAuth.pm ↑ Summary CatalystX/OAuth2/Request/GrantAuth.pm »