Lite/RelyingParty/Discover/Parser/XRDS.pm

filter: Statementstmt 51.6% 16 / 31 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod 0.0% 0 / 1 totaltotal 46.5% 20 / 43 CC 4 SCAR 23.5
CC
4
Cov
43%
parse
20.0
BEGIN
1.0
BEGIN
1.0
CRAP 10.5
« Lite/Realm.pm ↑ Summary Lite/Message/Decoder.pm »
1 package OpenID::Lite::RelyingParty::Discover::Parser::XRDS;
2  
3 2 ▶use Any::Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 with 'OpenID::Lite::Role::Parser';
5 2 with 'OpenID::Lite::Role::ErrorHandler';
6  
7 2 ▶use XML::LibXML;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use OpenID::Lite::RelyingParty::Discover::Service::Builder;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 0 ▶sub parse {
Subroutine parse: not called CC=4 SCAR=30.0
Pod undocumented
11 0 my ( $self, $result ) = @_;
12  
13 0 my $identifier = $result->normalized_identifier;
14 0 my $parser = XML::LibXML->new;
15 0 my $doc;
16 0 eval { $doc = $parser->parse_string( $result->content ); };
17 0 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
18 0 return $self->ERROR( sprintf q{Failed to parse xrds "%s"}, $@ );
19 }
20  
21 my @xrd
22 0 = $doc->findnodes(q{*[local-name()='XRDS']/*[local-name()='XRD']});
23 0 ▶ return $self->ERROR( sprintf q{XRD element not found for iname "%s".},
Branch: 1 branch
BranchTrueFalseTotal
unless @xrd > 0 0 0 0
24 $identifier )
25 unless @xrd > 0;
26  
27 0 my $xrd = $xrd[0];
28  
29 0 my $builder = OpenID::Lite::RelyingParty::Discover::Service::Builder->new(
30 claimed_identifier => $identifier, );
31 0 my $services = $builder->build_services($xrd);
32 0 ▶ return $self->ERROR(q{No service found.}) unless @$services > 0;
Branch: 1 branch
BranchTrueFalseTotal
unless @$services > 0 0 0 0
33 0 return $services;
34 }
35  
36 2 ▶no Any::Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
37 2 __PACKAGE__->meta->make_immutable;
38 2 1;
39  
« Lite/Realm.pm ↑ Summary Lite/Message/Decoder.pm »