Lite/RelyingParty/Discover/Fetcher/Yadis/HTMLExtractor.pm

filter: Statementstmt 94.4% 17 / 18 Branchbran 50.0% 1 / 2 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 77.4% 24 / 31 CC 3 SCAR 7.1
CC
3
Cov
83%
extract
3.4
BEGIN
1.0
BEGIN
1.0
CRAP 2.0
« Lite/RelyingParty/Discover/Method/Base.pm ↑ Summary Lite/Extension/Request.pm »
1 package OpenID::Lite::RelyingParty::Discover::Fetcher::Yadis::HTMLExtractor;
2  
3 3 ▶use HTML::TreeBuilder::XPath;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use URI::Escape ();
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use OpenID::Lite::Constants::Yadis qw(XRDS_HEADER YADIS_HEADER);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶sub extract {
Subroutine extract: called CC=3 SCAR=12.3
Pod undocumented
8 1 my ( $class, $content ) = @_;
9  
10 1 my $tree = HTML::TreeBuilder::XPath->new;
11 1 $tree->parse(lc $content);
12 1 ▶ my $location
Condition33%1/3
$tree->findvalue($class->_build_xpath_with('X-XRDS-Location')) || $tree->findvalue($class->_build_xpath_with('X-Yadis-Location'))
l!l&&r!l&&!r
001
MC/DC0%0/2
$tree->findvalue($class->_build_xpath_with('X-XRDS-Location')) || $tree->findvalue($class->_build_xpath_with('X-Yadis-Location'))
$tree->findvalue($class->_build_xpath_with('X-XRDS-Location')) $tree->findvalue($class->_build_xpath_with('X-Yadis-Location'))
Truth table33%1/3
A || B
A= $tree->findvalue($class->_build_xpath_with('X-XRDS-Location'))B= $tree->findvalue($class->_build_xpath_with('X-Yadis-Location'))
ABresult
1X1
011
000
13 = $tree->findvalue( $class->_build_xpath_with( XRDS_HEADER ) )
14 || $tree->findvalue( $class->_build_xpath_with( YADIS_HEADER ) );
15 1 ▶ return unless $location;
Branch: 1 branch
BranchTrueFalseTotal
unless $location 1 0 1
16 0 return URI::Escape::uri_unescape($location);
17 }
18  
19 2 ▶sub _build_xpath_with {
Subroutine _build_xpath_with: called CC=1 SCAR=0.0
20 2 my ( $class, $header ) = @_;
21 2 return sprintf(q{/html/head/meta[@http-equiv='%s']/@content}, lc $header)
22 }
23  
24 3 1;
25  
« Lite/RelyingParty/Discover/Method/Base.pm ↑ Summary Lite/Extension/Request.pm »