PONAPI/DAO/Request/RetrieveByRelationship.pm

filter: Statementstmt 100% 20 / 20 Branchbran 83.3% 5 / 6 Conditioncond 66.6% 2 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 3 / 3 Podpod 0.0% 0 / 1 totaltotal 85.7% 30 / 35 CC 5 SCAR 13.6
CC
5
Cov
93%
execute
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.9
« PONAPI/Exception.pm ↑ Summary PONAPI/DAO/Request/RetrieveRelationships.pm »
1 # ABSTRACT: DAO request - retrieve by relationship
2 package PONAPI::DAO::Request::RetrieveByRelationship;
3  
4 8 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 8 extends 'PONAPI::DAO::Request';
7  
8 8 with 'PONAPI::DAO::Request::Role::HasFields',
9 'PONAPI::DAO::Request::Role::HasFilter',
10 'PONAPI::DAO::Request::Role::HasInclude',
11 'PONAPI::DAO::Request::Role::HasPage',
12 'PONAPI::DAO::Request::Role::HasSort',
13 'PONAPI::DAO::Request::Role::HasID',
14 'PONAPI::DAO::Request::Role::HasRelationshipType';
15  
16 sub execute {
17 15 ▶ my $self = shift;
Subroutine execute: called CC=5 SCAR=16.2
Pod undocumented
18  
19 15 ▶ if ( $self->is_valid ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->is_valid) 10 5 15
20 10 my $repo = $self->repository;
21 10 my $document = $self->document;
22 10 my $one_to_many = $repo->has_one_to_many_relationship($self->type, $self->rel_type);
23  
24 10 ▶ $document->convert_to_collection if $one_to_many;
Branch: 1 branch
BranchTrueFalseTotal
if $one_to_many 4 6 10
25  
26 10 $repo->retrieve_by_relationship( %{ $self } );
27  
28 7 ▶ $document->add_null_resource
Branch: 1 branch
BranchTrueFalseTotal
unless $one_to_many or $document->has_resource_builders 0 7 7
Condition66%2/3
$one_to_many or $document->has_resource_builders
l!l&&r!l&&!r
430
MC/DC0%0/2
$one_to_many or $document->has_resource_builders
$one_to_many $document->has_resource_builders
Truth table66%2/3
A or B
A= $one_to_manyB= $document->has_resource_builders
ABresult
1X1
011
000
29 unless $one_to_many or $document->has_resource_builders;
30 }
31  
32 12 return $self->response();
33 }
34  
35 8 __PACKAGE__->meta->make_immutable;
36 8 ▶no Moose; 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
37  
38 __END__
39  
40 =pod
41  
42 =encoding UTF-8
43  
44 =head1 NAME
45  
46 PONAPI::DAO::Request::RetrieveByRelationship - DAO request - retrieve by relationship
47  
48 =head1 VERSION
49  
50 version 0.002012
51  
52 =head1 AUTHORS
53  
54 =over 4
55  
56 =item *
57  
58 Mickey Nasriachi <mickey@cpan.org>
59  
60 =item *
61  
62 Stevan Little <stevan@cpan.org>
63  
64 =item *
65  
66 Brian Fraser <hugmeir@cpan.org>
67  
68 =back
69  
70 =head1 COPYRIGHT AND LICENSE
71  
72 This software is copyright (c) 2016 by Mickey Nasriachi, Stevan Little, Brian Fraser.
73  
74 This is free software; you can redistribute it and/or modify it under
75 the same terms as the Perl 5 programming language system itself.
76  
77 =cut
« PONAPI/Exception.pm ↑ Summary PONAPI/DAO/Request/RetrieveRelationships.pm »