SAML2/AttributeConsumingService.pm

filter: Statementstmt 100% 29 / 29 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 1 / 1 totaltotal 97.6% 42 / 43 CC 4 SCAR 7.9
CC
4
Cov
97%
to_xml
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.2
« SAML2/Types.pm ↑ Summary SAML2/Role/ProtocolMessage.pm »
1 package Net::SAML2::AttributeConsumingService;
2 32 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 32 ▶use XML::Generator;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 32 ▶use URN::OASIS::SAML2 qw(URN_METADATA NS_METADATA);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 32 with 'Net::SAML2::Role::XMLLang';
6  
7 32 our $VERSION = '0.89'; # VERSION
8  
9 # ABSTRACT: An attribute consuming service object
10  
11 has namespace => (
12 is => 'ro',
13 isa => 'ArrayRef',
14 3 ▶ default => sub { return [NS_METADATA() => URN_METADATA()] },
Subroutine __ANON__: called CC=1 SCAR=0.0
15 32 );
16  
17 32 has service_name => (
18 is => 'ro',
19 isa => 'Str',
20 required => 1,
21 );
22  
23 32 has service_description => (
24 is => 'ro',
25 isa => 'Str',
26 predicate => '_has_service_description',
27 );
28  
29 32 has index => (
30 is => 'ro',
31 isa => 'Str',
32 required => 1,
33 );
34  
35 32 has default => (
36 is => 'ro',
37 isa => 'Bool',
38 default => 0,
39 );
40  
41 has attributes => (
42 is => 'ro',
43 isa => 'ArrayRef[Net::SAML2::RequestedAttribute]',
44 traits => ['Array'],
45 2 ▶ default => sub { [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
46 32 handles => { add_attribute => 'push', },
47 );
48  
49 has _xml_gen => (
50 is => 'ro',
51 isa => 'XML::Generator',
52 3 ▶ default => sub { return XML::Generator->new() },
Subroutine __ANON__: called CC=1 SCAR=0.0
53 32 init_arg => undef,
54 );
55  
56  
57 3 ▶sub to_xml {
Subroutine to_xml: called CC=4 SCAR=13.9
Pod documented
58 3 my $self = shift;
59  
60 die "Unable to create attribute consuming service, we require attributes"
61 3 ▶ unless @{ $self->attributes };
Branch: 1 branch
BranchTrueFalseTotal
unless @{$self->attributes;} 0 3 3
62  
63 3 my $xml = $self->_xml_gen();
64  
65 return $xml->AttributeConsumingService(
66 $self->namespace,
67 {
68 index => $self->index,
69 isDefault => $self->default ? 'true' : 'false',
70 },
71 $xml->ServiceName($self->namespace, $self->lang, $self->service_name),
72 $self->_has_service_description ? $xml->ServiceDescription($self->namespace, $self->lang, $self->service_description) : (),
73 3 ▶ map { $_->to_xml } @{ $self->attributes },
Branch: 2 branches
BranchTrueFalseTotal
$self->default ? : 2 1 3
$self->_has_service_description ? : 1 2 3
74 );
75 }
76  
77 32 __PACKAGE__->meta->make_immutable;
78  
79 __END__
« SAML2/Types.pm ↑ Summary SAML2/Role/ProtocolMessage.pm »