Lighthouse/User/Membership.pm

filter: Statementstmt 100% 26 / 26 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 97.1% 34 / 35 CC 3 SCAR 4.1
CC
3
Cov
96%
_translate_from_xml
2.0
load_from_xml
2.0
BEGIN
1.0
CRAP 1.5
« Lighthouse/Token.pm ↑ Summary Lighthouse/Project/Ticket/Version.pm »
1 package Net::Lighthouse::User::Membership;
2 3 ▶use Any::Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use Params::Validate ':all';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use Net::Lighthouse::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 # read only attr
7 3 has [qw/id user_id/] => (
8 isa => 'Int',
9 is => 'ro',
10 );
11  
12 3 has [qw/account project/] => (
13 isa => 'Str',
14 is => 'ro',
15 );
16  
17 3 ▶no Any::Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 3 __PACKAGE__->meta->make_immutable;
19  
20 2 ▶sub load_from_xml {
Subroutine load_from_xml: called CC=2 SCAR=6.9
Pod documented
21 2 my $self = shift;
22 2 validate_pos( @_,
23 { type => SCALAR | HASHREF, regex => qr/^\s*<membership|^HASH\(\w+\)$/ } );
24 2 my $ref = $self->_translate_from_xml(shift);
25  
26 # dirty hack: some attrs are read-only, and Mouse doesn't support
27 # writer => '...'
28 2 for my $k ( keys %$ref ) {
29 6 $self->{$k} = $ref->{$k};
30 }
31 2 return $self;
32 }
33  
34 2 ▶sub _translate_from_xml {
Subroutine _translate_from_xml: called CC=2 SCAR=7.0
35 2 my $self = shift;
36 2 my $ref = Net::Lighthouse::Util->translate_from_xml(shift);
37  
38 # current $ref contains user entry, which is not shown in the document,
39 # and it's not so useful too, let's delete it for now
40 2 ▶ delete $ref->{user} if exists $ref->{user};
Branch: 1 branch
BranchTrueFalseTotal
if exists $ref->{"user"} 2 0 2
41  
42 2 return $ref;
43 }
44  
45 3 1;
46  
47 __END__
« Lighthouse/Token.pm ↑ Summary Lighthouse/Project/Ticket/Version.pm »