blib/lib/Moose/Exception/MethodNameConflictInRoles.pm

filter: Statementstmt 100% 18 / 18 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 100% 25 / 25 CC 3 SCAR 5.9
CC
3
Cov
100%
_get_method_names
2.0
_build_message
2.0
BEGIN
1.0
CRAP 1.8
« blib/lib/Class/MOP/Method/Meta.pm ↑ Summary blib/lib/Moose/Exception/RequiredMethodsImportedByClass.pm »
1 package Moose::Exception::MethodNameConflictInRoles;
2 7 our $VERSION = '2.4001';
3  
4 7 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 7 extends 'Moose::Exception';
6 7 with 'Moose::Exception::Role::Class';
7  
8 7 has 'conflict' => (
9 traits => ['Array'],
10 is => 'ro',
11 isa => 'ArrayRef[Moose::Meta::Role::Method::Conflicting]',
12 handles => { conflict_methods_count => 'count',
13 get_method_at => 'get',
14 get_all_methods => 'elements',
15 },
16 required => 1
17 );
18  
19 10 ▶sub _get_method_names {
Subroutine _get_method_names: called CC=2 SCAR=6.9
20 10 my $self = shift;
21  
22 return ( $self->conflict_methods_count == 1 ?
23 "'".$self->get_method_at(0)->name."'":
24 10 ▶ Moose::Util::english_list( map { q{'} . $_->name . q{'} } $self->get_all_methods ) );
Branch: 1 branch
BranchTrueFalseTotal
$self->conflict_methods_count == 1 ? : 8 2 10
25 }
26  
27 10 ▶sub _build_message {
Subroutine _build_message: called CC=2 SCAR=6.9
28 10 my $self = shift;
29 10 my $count = $self->conflict_methods_count;
30 10 my $roles = $self->get_method_at(0)->roles_as_english_list;
31  
32 10 ▶ if( $count == 1 )
Branch: 1 branch
BranchTrueFalseTotal
if ($count == 1) { } 8 2 10
33 {
34 8 "Due to a method name conflict in roles "
35 .$roles.", the method ".$self->_get_method_names
36 ." must be implemented or excluded by '".$self->class_name."'";
37 }
38 else
39 {
40 2 "Due to method name conflicts in roles "
41 .$roles.", the methods ".$self->_get_method_names
42 ." must be implemented or excluded by '".$self->class_name."'";
43 }
44 }
45  
46 7 __PACKAGE__->meta->make_immutable;
47 7 1;
« blib/lib/Class/MOP/Method/Meta.pm ↑ Summary blib/lib/Moose/Exception/RequiredMethodsImportedByClass.pm »