| 1 | package PlantUML::ClassDiagram::Class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use PlantUML::ClassDiagram::Class::Factory; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use parent qw/Class::Accessor::Fast/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | __PACKAGE__->follow_best_practice; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | my @self_valiables = qw/ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | attribute | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | variables | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | relations | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | /; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | __PACKAGE__->mk_ro_accessors(@self_valiables); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=9 SCAR=45.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | my ($class, $name, $attribute, $variables, $methods, $relations) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | my $attr = +{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition0%0/10
$name || ''
$attribute || ''
$variables and scalar @$variables
$methods and scalar @$methods
$relations and scalar @$relations
MC/DC0%0/1
$name || ''
$name
MC/DC0%0/1
$attribute || ''
$attribute
MC/DC0%0/1
$variables and scalar @$variables
$variables
MC/DC0%0/1
$methods and scalar @$methods
$methods
MC/DC0%0/1
$relations and scalar @$relations
$relations
Truth table0%0/2
A
A= $name
Truth table0%0/2
A
A= $attribute
Truth table0%0/2
A
A= $variables
Truth table0%0/2
A
A= $methods
Truth table0%0/2
A
A= $relations
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | name => $name || '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | attribute => $attribute || '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | variables => ( $variables && scalar @$variables ) ? $variables : +[], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | methods => ( $methods && scalar @$methods ) ? $methods : +[], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | relations => ( $relations && scalar @$relations ) ? $relations : +[], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | return $class->SUPER::new($attr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | ▶ | sub build { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | my ($class, $class_string, $relations) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | my @lines = split(/\n/, $class_string); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | my $class_name_string = shift @lines; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | my $class_name = $class->_get_class_name($class_name_string); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | my $class_attribute = $class->_get_class_attribute($class_name_string); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | my $class_relations = $class->_get_relations( $class_name, $relations ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | # variables and methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | my ($class_variables, $class_methods) = (+[], +[]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | for my $line (@lines) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | chomp $line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | my $instance = PlantUML::ClassDiagram::Class::Factory->create($line); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | next unless $instance; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | push( @$class_variables, $instance ) if $instance->is_variable; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | push( @$class_methods, $instance ) if $instance->is_method; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | return $class->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | $class_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | $class_attribute, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | $class_variables, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | $class_methods, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | $class_relations | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | ▶ | sub _get_class_name { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_class_name: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | my ($class, $class_name_string) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | my ($class_name) = $class_name_string =~ /class\s+([\w|:]+)\s+.*\{/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | return $class_name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | ▶ | sub _get_class_attribute { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_class_attribute: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | my ($class, $class_name_string) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | my ($attribute) = $class_name_string =~ /^(\w+)\s*class/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | return $attribute || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$attribute || ''
MC/DC0%0/1
$attribute || ''
$attribute
Truth table0%0/2
A
A= $attribute
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | sub _get_relations { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_relations: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | my ($class, $class_name, $relations) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | return +[ grep { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | $_->get_from eq $class_name || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$_->get_from eq $class_name || $_->get_to eq $class_name
MC/DC0%0/2
$_->get_from eq $class_name || $_->get_to eq $class_name
$_->get_from eq $class_name
$_->get_to eq $class_name
Truth table0%0/3
A || B
A= $_->get_from eq $class_nameB= $_->get_to eq $class_name
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | $_->get_to eq $class_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | } @$relations ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | sub get_parents { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_parents: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | my $parent_relations = +[ grep { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | $_->get_name eq 'generalization' && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$_->get_name eq 'generalization' && $_->get_from eq $self->get_name
MC/DC0%0/2
$_->get_name eq 'generalization' && $_->get_from eq $self->get_name
$_->get_name eq 'generalization'
$_->get_from eq $self->get_name
Truth table0%0/3
A && B
A= $_->get_name eq 'generalization'B= $_->get_from eq $self->get_name
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | $_->get_from eq $self->get_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | } @{$self->get_relations} ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | return +[ map { $_->get_to } @$parent_relations ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | ▶ | sub is_abstract { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_abstract: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | ▶ | return ($self->get_attribute eq 'abstract') ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||