| 1 | #!/usr/bin/perl | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | package Class::Workflow::State::TransitionSet; | ||||||||||||||||||||||||||||
| 4 | 5 | ▶ | use Moose::Role; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 5 | ▶ | use Moose::Util::TypeConstraints; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 5 | ▶ | use Set::Object; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | subtype 'Set::Object' | ||||||||||||||||||||||||||||
| 10 | => as 'Object' | ||||||||||||||||||||||||||||
| 11 | 34 | ▶ | => where { $_[0]->isa("Set::Object") }; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | coerce "Set::Object" | ||||||||||||||||||||||||||||
| 14 | => from 'ArrayRef' | ||||||||||||||||||||||||||||
| 15 | 6 | ▶ | => via { Set::Object->new(@{ $_[0] }) }; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | has transitions => ( | ||||||||||||||||||||||||||||
| 18 | isa => "Set::Object", | ||||||||||||||||||||||||||||
| 19 | coerce => 1, | ||||||||||||||||||||||||||||
| 20 | accessor => "transition_set", | ||||||||||||||||||||||||||||
| 21 | 11 | ▶ | default => sub { Set::Object->new }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 5 | ); | |||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 25 | ▶ | sub transitions { | ||||||||||||||||||||||||||
|
Subroutine
transitions: called CC=4 SCAR=14.1
Pod
documented
| |||||||||||||||||||||||||||||
| 25 | 25 | my ( $self, @transitions ) = @_; | |||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 25 | ▶ | if ( @transitions ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 28 | # special case to allow set-as-array-ref | ||||||||||||||||||||||||||||
| 29 | 5 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 30 | 3 | ▶ | @transitions = @{ $transitions[0] } if @transitions == 1 and ref($transitions[0]) eq "ARRAY"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@transitions == 1 and ref $transitions[0] eq "ARRAY"
MC/DC0%0/2
@transitions == 1 and ref $transitions[0] eq "ARRAY"
@transitions == 1
ref $transitions[0] eq "ARRAY"
Truth table33%1/3
A and B
A= @transitions == 1B= ref $transitions[0] eq "ARRAY"
| |||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 3 | $self->transition_set( Set::Object->new( @transitions ) ); | |||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 3 | return @transitions; | |||||||||||||||||||||||||||
| 35 | } else { | ||||||||||||||||||||||||||||
| 36 | 22 | return $self->transition_set->members; | |||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 0 | ▶ | sub clear_transitions { | ||||||||||||||||||||||||||
|
Subroutine
clear_transitions: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 41 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 42 | 0 | $self->transition_set( Set::Object->new ); | |||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 0 | ▶ | sub remove_transitions { | ||||||||||||||||||||||||||
|
Subroutine
remove_transitions: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 46 | 0 | my ( $self, @transitions ) = @_; | |||||||||||||||||||||||||||
| 47 | 0 | $self->transition_set->remove( @transitions ); | |||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 1 | ▶ | sub add_transitions { | ||||||||||||||||||||||||||
|
Subroutine
add_transitions: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 51 | 1 | my ( $self, @transitions ) = @_; | |||||||||||||||||||||||||||
| 52 | 1 | $self->transition_set->insert( @transitions ); | |||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 9 | ▶ | sub has_transition { | ||||||||||||||||||||||||||
|
Subroutine
has_transition: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 56 | 9 | my ( $self, $transition ) = @_; | |||||||||||||||||||||||||||
| 57 | 9 | $self->transition_set->includes( $transition ); | |||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 0 | ▶ | sub has_transitions { | ||||||||||||||||||||||||||
|
Subroutine
has_transitions: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 61 | 0 | my ( $self, @transitions ) = @_; | |||||||||||||||||||||||||||
| 62 | 0 | $self->transition_set->includes( @transitions ); | |||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 5 | __PACKAGE__; | |||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | __END__ | ||||||||||||||||||||||||||||