| 1 | { | ||||||||||||||||||||||||||||
| 2 | package Net::Braintree::AdvancedSearchNodes; | ||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | } | ||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | { | ||||||||||||||||||||||||||||
| 7 | 1 | package Net::Braintree::SearchNode; | |||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 1 | has 'searcher' => (is => 'rw'); | |||||||||||||||||||||||||||
| 11 | 1 | has 'name' => (is => 'rw'); | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 0 | ▶ | has 'criteria' => (is => 'rw', default => sub {shift->default_criteria()}); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 0 | ▶ | sub default_criteria { | ||||||||||||||||||||||||||
|
Subroutine
default_criteria: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 16 | 0 | return {}; | |||||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 0 | ▶ | sub active { | ||||||||||||||||||||||||||
|
Subroutine
active: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 20 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 21 | 0 | return %{$self->criteria}; | |||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 0 | ▶ | sub add_node { | ||||||||||||||||||||||||||
|
Subroutine
add_node: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 25 | 0 | my ($self, $operator, $operand) = @_; | |||||||||||||||||||||||||||
| 26 | 0 | $self->criteria->{$operator} = $operand; | |||||||||||||||||||||||||||
| 27 | 0 | return $self->searcher; | |||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 1 | 1; | |||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | { | ||||||||||||||||||||||||||||
| 34 | 1 | package Net::Braintree::IsNode; | |||||||||||||||||||||||||||
| 35 | 1 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 36 | 1 | extends ("Net::Braintree::SearchNode"); | |||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 0 | ▶ | sub is { | ||||||||||||||||||||||||||
|
Subroutine
is: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 39 | 0 | my ($self, $operand) = @_; | |||||||||||||||||||||||||||
| 40 | 0 | return $self->add_node("is", $operand); | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | 1 | 1; | |||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | { | ||||||||||||||||||||||||||||
| 46 | 1 | package Net::Braintree::EqualityNode; | |||||||||||||||||||||||||||
| 47 | 1 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 48 | 1 | extends ("Net::Braintree::IsNode"); | |||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 0 | ▶ | sub is_not { | ||||||||||||||||||||||||||
|
Subroutine
is_not: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 51 | 0 | my ($self, $operand) = @_; | |||||||||||||||||||||||||||
| 52 | 0 | return $self->add_node("is_not", $operand); | |||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | 1 | 1; | |||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | { | ||||||||||||||||||||||||||||
| 58 | 1 | package Net::Braintree::KeyValueNode; | |||||||||||||||||||||||||||
| 59 | 1 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 60 | 1 | extends ("Net::Braintree::SearchNode"); | |||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 0 | ▶ | sub default_criteria { | ||||||||||||||||||||||||||
|
Subroutine
default_criteria: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 63 | 0 | return ""; | |||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 0 | ▶ | sub active { | ||||||||||||||||||||||||||
|
Subroutine
active: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 67 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 68 | 0 | return $self->criteria; | |||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 0 | ▶ | sub is { | ||||||||||||||||||||||||||
|
Subroutine
is: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 72 | 0 | my ($self, $operand) = @_; | |||||||||||||||||||||||||||
| 73 | 0 | $self->criteria($operand); | |||||||||||||||||||||||||||
| 74 | 0 | return $self->searcher; | |||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||
| 76 | 1 | 1; | |||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | { | ||||||||||||||||||||||||||||
| 80 | 1 | package Net::Braintree::PartialMatchNode; | |||||||||||||||||||||||||||
| 81 | 1 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 82 | 1 | extends ("Net::Braintree::EqualityNode"); | |||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | 0 | ▶ | sub starts_with { | ||||||||||||||||||||||||||
|
Subroutine
starts_with: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 85 | 0 | my ($self, $operand) = @_; | |||||||||||||||||||||||||||
| 86 | 0 | return $self->add_node("starts_with", $operand); | |||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | 0 | ▶ | sub ends_with { | ||||||||||||||||||||||||||
|
Subroutine
ends_with: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 90 | 0 | my ($self, $operand) = @_; | |||||||||||||||||||||||||||
| 91 | 0 | return $self->add_node("ends_with", $operand); | |||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||
| 93 | 1 | 1; | |||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | { | ||||||||||||||||||||||||||||
| 97 | 1 | package Net::Braintree::TextNode; | |||||||||||||||||||||||||||
| 98 | 1 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 99 | 1 | extends ("Net::Braintree::PartialMatchNode"); | |||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | 0 | ▶ | sub contains { | ||||||||||||||||||||||||||
|
Subroutine
contains: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 102 | 0 | my ($self, $operand) = @_; | |||||||||||||||||||||||||||
| 103 | 0 | return $self->add_node("contains", $operand); | |||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||
| 105 | 1 | 1; | |||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | { | ||||||||||||||||||||||||||||
| 109 | 1 | package Net::Braintree::RangeNode; | |||||||||||||||||||||||||||
| 110 | 1 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 111 | 1 | extends ("Net::Braintree::EqualityNode"); | |||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | 1 | ▶ | use overload ( '>=' => 'min', '<=' => 'max'); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | 0 | ▶ | sub min { | ||||||||||||||||||||||||||
|
Subroutine
min: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 116 | 0 | my ($self, $operand) = @_; | |||||||||||||||||||||||||||
| 117 | 0 | return $self->add_node("min", $operand); | |||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | 0 | ▶ | sub max { | ||||||||||||||||||||||||||
|
Subroutine
max: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 121 | 0 | my ($self, $operand) = @_; | |||||||||||||||||||||||||||
| 122 | 0 | return $self->add_node("max", $operand); | |||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | 0 | ▶ | sub between { | ||||||||||||||||||||||||||
|
Subroutine
between: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 126 | 0 | my ($self, $min, $max) = @_; | |||||||||||||||||||||||||||
| 127 | 0 | $self->max($max); | |||||||||||||||||||||||||||
| 128 | 0 | $self->min($min); | |||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | 1 | 1; | |||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | { | ||||||||||||||||||||||||||||
| 135 | 1 | package Net::Braintree::MultipleValuesNode; | |||||||||||||||||||||||||||
| 136 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 137 | 1 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 138 | 1 | ▶ | use Net::Braintree::Util; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 139 | 1 | extends ("Net::Braintree::SearchNode"); | |||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | 1 | has 'allowed_values' => (is => 'rw'); | |||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | 0 | ▶ | sub default_criteria { | ||||||||||||||||||||||||||
|
Subroutine
default_criteria: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 144 | 0 | return []; | |||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | 0 | ▶ | sub active { | ||||||||||||||||||||||||||
|
Subroutine
active: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 148 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 149 | 0 | return @{$self->criteria}; | |||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | 0 | ▶ | sub is { | ||||||||||||||||||||||||||
|
Subroutine
is: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 153 | 0 | shift->in(@_); | |||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | 0 | ▶ | sub _args_to_array { | ||||||||||||||||||||||||||
|
Subroutine
_args_to_array: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 157 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 158 | 0 | my @args; | |||||||||||||||||||||||||||
| 159 | 0 | ▶ | if (ref($_[0]) eq 'ARRAY') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 160 | 0 | @args = @{$_[0]}; | |||||||||||||||||||||||||||
| 161 | } else { | ||||||||||||||||||||||||||||
| 162 | 0 | @args = @_; | |||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||
| 164 | 0 | return @args; | |||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | 0 | ▶ | sub in { | ||||||||||||||||||||||||||
|
Subroutine
in: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 168 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 169 | 0 | my @values = $self->_args_to_array(@_); | |||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | 0 | my $bad_values = difference_arrays(\@values, $self->allowed_values); | |||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||
| 173 | 0 | ▶ | if (@$bad_values && $self->allowed_values) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@$bad_values and $self->allowed_values
MC/DC0%0/2
@$bad_values and $self->allowed_values
@$bad_values
$self->allowed_values
Truth table0%0/3
A and B
A= @$bad_valuesB= $self->allowed_values
| |||||||||||||||||||||||||||||
| 174 | 0 | croak "Invalid Argument(s) for " . $self->name . ": " . join(", ", @$bad_values); | |||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||
| 177 | 0 | @{$self->criteria} = @values; | |||||||||||||||||||||||||||
| 178 | 0 | return $self->searcher; | |||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||
| 181 | 1 | 1; | |||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||