blib/lib/SOAP/WSDL/Generator/Iterator/WSDL11.pm

filter: Statementstmt 28.5% 16 / 56 Branchbran 0.0% 0 / 22 Conditioncond 0.0% 0 / 11 MC/DCmcdc 0.0% 0 / 7 Subroutinesub 27.2% 3 / 11 Podpod 0.0% 0 / 3 totaltotal 17.2% 19 / 110 CC 16 SCAR 24.7
CC
16
Cov
18%
__ANON__
20.0
__ANON__
20.0
__ANON__
12.0
CRAP 11.8
« blib/lib/SOAP/WSDL/XSD/SimpleType.pm ↑ Summary blib/lib/SOAP/WSDL/Generator/PrefixResolver.pm »
1 package SOAP::WSDL::Generator::Iterator::WSDL11;
2 1 ▶use strict; use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use Class::Std::Fast;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 our $VERSION = 3.004;
6  
7 1 my %definitions_of :ATTR(:name<definitions> :default<[]>);
8 1 my %nodes_of :ATTR(:name<nodes> :default<[]>);
9  
10 # memoization attributes
11 1 my %portType_of :ATTR();
12 1 my %types_of :ATTR();
13  
14 my %METHOD_OF = (
15 'SOAP::WSDL::Definitions' => 'get_service',
16 'SOAP::WSDL::Service' => 'get_port',
17 0 ▶ 'SOAP::WSDL::Port' => sub {
Subroutine __ANON__: not called CC=4 SCAR=30.0
18 0 my ($self, $node) = @_;
19 0 ▶ return if ! $node->first_address()
Branch: 1 branch
BranchTrueFalseTotal
unless $node->first_address and $node->first_address->isa("SOAP::WSDL::SOAP::Address") 0 0 0
Condition0%0/3
$node->first_address and $node->first_address->isa("SOAP::WSDL::SOAP::Address")
!ll&&!rl&&r
000
MC/DC0%0/2
$node->first_address and $node->first_address->isa("SOAP::WSDL::SOAP::Address")
$node->first_address $node->first_address->isa("SOAP::WSDL::SOAP::Address")
Truth table0%0/3
A and B
A= $node->first_addressB= $node->first_address->isa("SOAP::WSDL::SOAP::Address")
ABresult
0X0
100
111
20 or ! $node->first_address()->isa('SOAP::WSDL::SOAP::Address');
21  
22 0 ▶ return [ $self->get_definitions()
Condition0%0/3
$self->get_definitions->find_binding($node->expand($node->get_binding)) || ()
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->get_definitions->find_binding($node->expand($node->get_binding)) || ()
$self->get_definitions->find_binding($node->expand($node->get_binding)) ()
Truth table0%0/3
A || B
A= $self->get_definitions->find_binding($node->expand($node->get_binding))B= ()
ABresult
1X1
011
000
23 ->find_binding( $node->expand( $node->get_binding() ) ) || () ];
24 },
25  
26 0 ▶ 'SOAP::WSDL::Binding' => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
27 0 my ($self, $node) = @_;
28  
29 # remember referenced portType
30 0 ▶ $portType_of{ ident $self } = $self->get_definitions()
Branch: 1 branch
BranchTrueFalseTotal
$portType_of{&ident($self)} = $self->get_definitions->find_portType($node->expand($node->get_type)) or return [] 0 0 0
31 ->find_portType( $node->expand( $node->get_type ) )
32 or return [];
33  
34 0 return $node->get_operation();
35 },
36  
37 0 ▶ 'SOAP::WSDL::Operation' => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
38 0 my ($self, $node) = @_;
39  
40 0 my $name = $node->get_name();
41  
42 # get the equally named operation from the portType
43 0 my ($op) = grep { $_->get_name() eq $name }
44 0 ▶ @{ $portType_of{ ident $self }->get_operation() }
Branch: 1 branch
BranchTrueFalseTotal
my($op) = grep({$_->get_name eq $name;} @{$portType_of{&ident($self)}->get_operation;}) or return [] 0 0 0
45 or return [];
46  
47 0 return [ @{ $op->get_input }, @{ $op->get_output }, @{ $op->get_fault } ]
48 },
49  
50 0 ▶ 'SOAP::WSDL::OpMessage' => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
51 0 my ($self, $node) = @_;
52 0 ▶ return if ( ref $node->get_parent() eq 'SOAP::WSDL::Binding' ); # we're in binding
Branch: 1 branch
BranchTrueFalseTotal
if ref $node->get_parent eq "SOAP::WSDL::Binding" 0 0 0
53  
54 # TODO maybe allow more messages && overloading by specifying name
55  
56 0 ▶ return [ $self->get_definitions()->find_message(
Condition0%0/3
$self->get_definitions->find_message($node->expand($node->get_message)) || ()
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->get_definitions->find_message($node->expand($node->get_message)) || ()
$self->get_definitions->find_message($node->expand($node->get_message)) ()
Truth table0%0/3
A || B
A= $self->get_definitions->find_message($node->expand($node->get_message))B= ()
ABresult
1X1
011
000
57 $node->expand( $node->get_message() )
58 ) || () ];
59 },
60  
61 'SOAP::WSDL::Message' => 'get_part',
62  
63 0 ▶ 'SOAP::WSDL::Part' => sub {
Subroutine __ANON__: not called CC=4 SCAR=30.0
64 0 my ($self, $node) = @_;
65 0 my $ident = ident $self;
66 0 ▶ my $types = $types_of{ $ident } = $definitions_of{ $ident }->get_types()->[0]
Branch: 1 branch
BranchTrueFalseTotal
my $types = $types_of{$ident} = $definitions_of{$ident}->get_types->[0] or return [] 0 0 0
67 or return [];
68 return [
69 # If we have a type, this type is to be used in document/literal
70 # as global type. However this is forbidden, at least by WS-I.
71 # We should store the style/encoding somewhere, and regard it.
72 # TODO: auto-generate element for RPC bindings
73 $node->get_type()
74 0 ▶ ? do {
Branch: 1 branch
BranchTrueFalseTotal
$node->get_type ? : 0 0 0
75 0 ▶ die "unsupported global type <"
Branch: 1 branch
BranchTrueFalseTotal
$node->get_element ? : 0 0 0
76 . $node->get_type . "> found in part <". $node->get_name() . ">\n"
77 . "Looks like a rpc/literal WSDL, which is not supported by SOAP::WSDL\n";
78 ## use this once we can auto-generate an element for RPC bindings
79 # $types->find_type( $node->expand($node->get_type) )
80 }
81 : (),
82 $node->get_element()
83 ? $types->find_element( $node->expand($node->get_element) )
84 : (),
85 ];
86 },
87 1 );
88  
89 0 ▶sub init {
Subroutine init: not called CC=2 SCAR=17.9
Pod undocumented
90 0 my ($self, $arg_of) = @_;
91 0 my $ident = ident $self;
92 0 undef $portType_of{ $ident };
93 0 undef $types_of{ $ident };
94 $nodes_of{ $ident } = [
95 exists($arg_of->{ node })
96 ? $arg_of->{ node }
97 0 ▶ : $definitions_of{ ident $self }
Branch: 1 branch
BranchTrueFalseTotal
exists $arg_of->{'node'} ? : 0 0 0
98 ];
99 }
100  
101 0 ▶sub get_next {
Subroutine get_next: not called CC=3 SCAR=24.8
Pod undocumented
102 0 my $self = shift;
103 0 my $ident = ident $self;
104  
105 0 my $node = shift @{ $nodes_of{ $ident }};
106 0 ▶ return if ! defined $node;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $node 0 0 0
107  
108 0 ▶ unshift @{ $nodes_of{ $ident }}, @{ $self->get_nextNodes( $node ) || [] };
Condition0%0/2
$self->get_nextNodes($node) || []
l!l
00
MC/DC0%0/1
$self->get_nextNodes($node) || []
$self->get_nextNodes($node)
Truth table0%0/2
A
A= $self->get_nextNodes($node)
Aresult
11
00
109  
110 0 return $node;
111 }
112  
113 0 ▶sub get_nextNodes {
Subroutine get_nextNodes: not called CC=3 SCAR=24.8
Pod undocumented
114 0 my ($self, $node) = @_;
115  
116 0 ▶ my $method = $METHOD_OF{ ref $node }
Branch: 1 branch
BranchTrueFalseTotal
my $method = $METHOD_OF{ref $node} or return [] 0 0 0
117 or return [];
118  
119 0 ▶ return (ref($method) eq 'CODE')
Branch: 1 branch
BranchTrueFalseTotal
ref $method eq 'CODE' ? : 0 0 0
120 ? $method->( $self, $node )
121 : $node->can($method)->( $node );
122 }
123  
124 1 1;
125  
126 __END__
« blib/lib/SOAP/WSDL/XSD/SimpleType.pm ↑ Summary blib/lib/SOAP/WSDL/Generator/PrefixResolver.pm »