PML/StandardFactory.pm

filter: Statementstmt 92.5% 75 / 81 Branchbran 62.5% 5 / 8 Conditioncond 50.0% 3 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 96.4% 27 / 28 Podpod 100% 12 / 12 totaltotal 88.4% 122 / 138 CC 7 SCAR 6.4
CC
7
Cov
87%
createAlt
6.0
createTypedNode
5.2
createPMLInstance
2.0
CRAP 1.9
« PML/Container.pm ↑ Summary PML/Schema/Root.pm »
1 package Treex::PML::StandardFactory;
2  
3 9 ▶use 5.008;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 9 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 9 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
9 9 $VERSION='2.29'; # version template
10 }
11 9 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 9 ▶use base qw(Treex::PML::Factory);
Subroutine BEGIN: called CC=1 SCAR=0.0
14 9 ▶use UNIVERSAL::DOES;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 9 ▶use Treex::PML::Struct;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 9 ▶use Treex::PML::Container;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 9 ▶use Treex::PML::Alt;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 9 ▶use Treex::PML::List;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 9 ▶use Treex::PML::Seq;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 9 ▶use Treex::PML::Node;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 9 ▶use Treex::PML::FSFormat;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 9 ▶use Treex::PML::Document;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 51 ▶sub createPMLSchema {
Subroutine createPMLSchema: called CC=1 SCAR=0.0
Pod documented
26 51 my $self = shift;
27 51 return Treex::PML::Schema->new(@_);
28 }
29  
30 93 ▶sub createPMLInstance {
Subroutine createPMLInstance: called CC=2 SCAR=6.9
Pod documented
31 93 my $self = shift;
32 93 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 28 65 93
33 28 return $self->createPMLInstance()->load(@_);
34 } else {
35 65 return Treex::PML::Instance->new();
36 }
37 }
38  
39 25 ▶sub createDocument {
Subroutine createDocument: called CC=1 SCAR=0.0
Pod documented
40 25 my $self = shift;
41 25 return Treex::PML::Document->new(@_);
42 }
43  
44 25 ▶sub createDocumentFromFile {
Subroutine createDocumentFromFile: called CC=1 SCAR=0.0
Pod documented
45 25 my $self = shift;
46 25 return $self->createDocument->load(@_);
47 }
48  
49 27 ▶sub createFSFormat {
Subroutine createFSFormat: called CC=1 SCAR=0.0
Pod documented
50 27 my $self = shift;
51 27 return Treex::PML::FSFormat->new(@_);
52 }
53  
54 11235 ▶sub createNode {
Subroutine createNode: called CC=1 SCAR=0.0
Pod documented
55 11235 my $self=shift;
56 11235 return Treex::PML::Node->new(@_);
57 }
58  
59 11235 ▶sub createTypedNode {
Subroutine createTypedNode: called CC=4 SCAR=16.5
Pod documented
60 11235 my $self = shift;
61 11235 my $node;
62 11235 ▶ if (@_>1 and !ref($_[0]) and UNIVERSAL::DOES::does($_[1],'Treex::PML::Schema')) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ > 1 and not ref $_[0] and UNIVERSAL::DOES::does($_[1], 'Treex::PML::Schema')) { } 0 11235 11235
Condition50%3/6
@_ > 1 and not ref $_[0] and UNIVERSAL::DOES::does($_[1], "Treex::PML::Schema")
!ll&&!rl&&r
1123500
@_ > 1 and not ref $_[0]
!ll&&!rl&&r
28112070
MC/DC0%0/3
@_ > 1 and not ref $_[0] and UNIVERSAL::DOES::does($_[1], "Treex::PML::Schema")
@_ > 1 not ref $_[0] UNIVERSAL::DOES::does($_[1], "Treex::PML::Schema")
Truth table50%2/4
A and not(B) and C
A= @_ > 1B= not ref $_[0]C= UNIVERSAL::DOES::does($_[1], "Treex::PML::Schema")
ABCresult
0XX0
10X0
1100
1111
63 0 my $type = shift;
64 0 my $schema = shift;
65 0 $node = $self->createNode(@_);
66 0 $node->set_type_by_name($schema,$type);
67 } else {
68 11235 my $decl = shift;
69 11235 $node = $self->createNode(@_);
70 11235 $node->set_type($decl);
71 }
72 11235 return $node;
73 }
74  
75 15900 ▶sub createList {
Subroutine createList: called CC=2 SCAR=6.9
Pod documented
76 15900 my $self = shift;
77 15900 ▶ return @_>0 ? Treex::PML::List->new_from_ref(@_) : Treex::PML::List->new();
Branch: 1 branch
BranchTrueFalseTotal
@_ > 0 ? : 15845 55 15900
78 }
79  
80 673 ▶sub createSeq {
Subroutine createSeq: called CC=1 SCAR=0.0
Pod documented
81 673 my $self = shift;
82 673 return Treex::PML::Seq->new(@_);
83 }
84  
85 0 ▶sub createAlt {
Subroutine createAlt: not called CC=2 SCAR=17.9
Pod documented
86 0 my $self = shift;
87 0 ▶ return @_>0 ? Treex::PML::Alt->new_from_ref(@_) : Treex::PML::Alt->new();
Branch: 1 branch
BranchTrueFalseTotal
@_ > 0 ? : 0 0 0
88 }
89  
90 207 ▶sub createContainer {
Subroutine createContainer: called CC=1 SCAR=0.0
Pod documented
91 207 my $self = shift;
92 207 return Treex::PML::Container->new(@_);
93 }
94  
95 15493 ▶sub createStructure {
Subroutine createStructure: called CC=1 SCAR=0.0
Pod documented
96 15493 my $self = shift;
97 15493 return Treex::PML::Struct->new(@_);
98 }
99  
100  
101 9 1;
102 __END__
« PML/Container.pm ↑ Summary PML/Schema/Root.pm »