DBIC/Unique.pm

filter: Statementstmt 77.2% 17 / 22 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 71.4% 5 / 7 Podpod 0.0% 0 / 2 totaltotal 66.6% 22 / 33 CC 2 SCAR 8.6
CC
2
Cov
71%
validate
6.0
message
2.0
BEGIN
1.0
CRAP 2.4
« DBIC/Exist.pm ↑ Summary DBIC.pm »
1 package Dancer2::Plugin::FormValidator::Extension::DBIC::Unique;
2  
3 1 ▶use strict; use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 with 'Dancer2::Plugin::FormValidator::Role::Validator';
10  
11 0 ▶sub message {
Subroutine message: not called CC=1 SCAR=6.9
Pod undocumented
12 return {
13 0 en => '%s is already exists',
14 ru => '%s уже существует',
15 de => '%s ist bereits vorhanden',
16 };
17 }
18  
19 0 ▶sub validate {
Subroutine validate: not called CC=2 SCAR=17.9
Pod undocumented
20 0 my ($self, $field, $input, $source, $attribute) = @_;
21  
22 0 ▶ if ($self->_field_defined_and_non_empty($field, $input)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_field_defined_and_non_empty($field, $input)) 0 0 0
23 return not $self->extension->schema->resultset($source)->single(
24 {
25 0 $attribute => $input->{$field},
26 }
27 );
28 }
29  
30 0 return 1;
31 }
32  
33 1 1;
« DBIC/Exist.pm ↑ Summary DBIC.pm »