Mojo/SAML/Document/RequestedAttribute.pm untested

filter: Statementstmt 0.0% 0 / 24 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 3 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 36 CC 5 SCAR 30.9
CC
5
Cov
0%
tag_attrs
30.0
BEGIN
2.0
BEGIN
2.0
CRAP 22.0
1 package Mojo::SAML::Document::RequestedAttribute;
2  
3 use Mojo::Base 'Mojo::SAML::Document';
4  
5 use Mojo::SAML::Names;
6  
7 has template => sub { shift->build_template(<<'XML') };
8 %= tag RequestedAttribute => $self->tag_attrs
9 XML
10  
11 has name => sub { Carp::croak 'name is required' };
12 has [qw/is_required name_format friendly_name/];
13  
14 sub tag_attrs {
15 my $self = shift;
16 my @attrs = (
17 xmlns => 'urn:oasis:names:tc:SAML:2.0:metadata',
18 Name => $self->name,
19 );
20 if (defined(my $format = $self->name_format)) {
21 push @attrs, NameFormat => Mojo::SAML::Names::attrname_format($format);
22 }
23 if (defined(my $name = $self->friendly_name)) {
24 push @attrs, FriendlyName => $name;
25 }
26 if (defined(my $required = $self->is_required)) {
27 push @attrs, isRequired => $required ? 'true' : 'false';
28 }
29  
30 return @attrs;
31 }
32  
33 1;
34  
35 =head1 NAME
36  
37 Mojo::SAML::Document::RequestedAttribute
38  
39 =head1 DESCRIPTION
40  
41 Represents an RequestedAttribute SAML metadata tag
42  
43 =head1 ATTRIBUTES
44  
45 L<Mojo::SAML::Document::RequestedAttribute> inherits all attributes from L<Mojo::SAML::Document> and implements the following new ones.
46  
47 =head2 name
48  
49 Required.
50 The machine-readable name of the attribute to be returned.
51  
52 =head2 name_format
53  
54 Optional.
55 The SAML-defined format of the attribute name or short alias as understood by L<Mojo::SAML::Names/attrname_format>.
56 Per the spec, if this is not given it is undestood to mean C<urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified>.
57  
58 =head2 friendly_name
59  
60 Optional.
61 The (possibly) human-readable name of the attribute to be returned.
62  
63 =head2 is_required
64  
65 A boolean indicating that this attribute is a required value.
66  
67 =head2 template
68  
69 A template specific to the document type.
70  
71