| 1 | package PlantUML::ClassDiagram::Class::Factory; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 2 | ▶ | use utf8; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 2 | ▶ | use PlantUML::ClassDiagram::Class::Method; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 2 | ▶ | use PlantUML::ClassDiagram::Class::Variable; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 2 | my $METHOD = 'PlantUML::ClassDiagram::Class::Method'; | |||||||||
| 10 | 2 | my $VARIABLE = 'PlantUML::ClassDiagram::Class::Variable'; | |||||||||
| 11 | |||||||||||
| 12 | 9 | ▶ | sub create { | ||||||||
|
Subroutine
create: called CC=5 SCAR=16.2
Pod
undocumented
| |||||||||||
| 13 | 9 | my ($class, $string) = @_; | |||||||||
| 14 | |||||||||||
| 15 | 9 | ▶ | return undef if $class->_check_is_separator($string); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | 5 | ▶ | return undef if $class->_check_is_comment($string); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 17 | |||||||||||
| 18 | 4 | ▶ | return $METHOD->build($string) if $class->_check_is_method($string); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | 1 | ▶ | return $VARIABLE->build($string) if $class->_check_is_variable($string); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | |||||||||||
| 21 | 0 | return undef; | |||||||||
| 22 | } | ||||||||||
| 23 | |||||||||||
| 24 | 9 | ▶ | sub _check_is_separator { | ||||||||
|
Subroutine
_check_is_separator: called CC=2 SCAR=6.9
| |||||||||||
| 25 | 9 | my ($class, $string) = @_; | |||||||||
| 26 | |||||||||||
| 27 | 9 | ▶ | return 1 if ($string =~ /(--|__|==|\.\.)/); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | 5 | return 0; | |||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | 5 | ▶ | sub _check_is_comment { | ||||||||
|
Subroutine
_check_is_comment: called CC=2 SCAR=6.9
| |||||||||||
| 32 | 5 | my ($class, $string) = @_; | |||||||||
| 33 | |||||||||||
| 34 | 5 | ▶ | return 1 if ($string =~ /'.*'/); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | 4 | return 0; | |||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | 4 | ▶ | sub _check_is_method { | ||||||||
|
Subroutine
_check_is_method: called CC=2 SCAR=6.9
| |||||||||||
| 39 | 4 | my ($class, $string) = @_; | |||||||||
| 40 | |||||||||||
| 41 | 4 | ▶ | return 1 if ($string =~ /\w+\(.*\)/); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | 1 | return 0; | |||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | 1 | ▶ | sub _check_is_variable { | ||||||||
|
Subroutine
_check_is_variable: called CC=2 SCAR=8.1
| |||||||||||
| 46 | 1 | my ($class, $string) = @_; | |||||||||
| 47 | |||||||||||
| 48 | 1 | ▶ | return 1 if ($string =~ /\w+/); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | 0 | return 0; | |||||||||
| 50 | } | ||||||||||
| 51 | |||||||||||
| 52 | 2 | 1; | |||||||||