PONAPI/DAO/Request/Role/HasRelationshipType.pm

filter: Statementstmt 100% 14 / 14 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 100% 21 / 21 CC 3 SCAR 7.9
CC
3
Cov
100%
_validate_rel_type
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.2
« PONAPI/DAO/Request/Role/HasPage.pm ↑ Summary PONAPI/DAO/Request/UpdateRelationships.pm »
1 # ABSTRACT: DAO request role - `relationship type`
2 package PONAPI::DAO::Request::Role::HasRelationshipType;
3  
4 8 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 8 has rel_type => (
7 is => 'ro',
8 isa => 'Str',
9 predicate => 'has_rel_type',
10 );
11  
12 sub _validate_rel_type {
13 42 ▶ my ( $self, $args ) = @_;
Subroutine _validate_rel_type: called CC=3 SCAR=11.0
14  
15 42 ▶ return $self->_bad_request( "`relationship type` is missing for this request" )
Branch: 1 branch
BranchTrueFalseTotal
unless $self->has_rel_type 4 38 42
16 unless $self->has_rel_type;
17  
18 38 my $type = $self->type;
19 38 my $rel_type = $self->rel_type;
20  
21 38 ▶ if ( !$self->repository->has_relationship( $type, $rel_type ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->repository->has_relationship($type, $rel_type)) 1 37 38
22 1 return $self->_bad_request( "Types `$type` and `$rel_type` are not related", 404 )
23 }
24 }
25  
26 8 ▶no Moose::Role; 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 __END__
29  
30 =pod
31  
32 =encoding UTF-8
33  
34 =head1 NAME
35  
36 PONAPI::DAO::Request::Role::HasRelationshipType - DAO request role - `relationship type`
37  
38 =head1 VERSION
39  
40 version 0.003002
41  
42 =head1 AUTHORS
43  
44 =over 4
45  
46 =item *
47  
48 Mickey Nasriachi <mickey@cpan.org>
49  
50 =item *
51  
52 Stevan Little <stevan@cpan.org>
53  
54 =item *
55  
56 Brian Fraser <hugmeir@cpan.org>
57  
58 =back
59  
60 =head1 COPYRIGHT AND LICENSE
61  
62 This software is copyright (c) 2017 by Mickey Nasriachi, Stevan Little, Brian Fraser.
63  
64 This is free software; you can redistribute it and/or modify it under
65 the same terms as the Perl 5 programming language system itself.
66  
67 =cut
« PONAPI/DAO/Request/Role/HasPage.pm ↑ Summary PONAPI/DAO/Request/UpdateRelationships.pm »