File Coverage

blib/lib/SOAP/WSDL/Types.pm
Criterion Covered Total %
statement 33 42 78.5
branch 6 12 50.0
condition n/a
subroutine 8 9 88.8
pod 0 4 0.0
total 47 67 70.1


line stmt bran cond sub pod time code
1             package SOAP::WSDL::Types;
2 1     1   964 use strict;
  1         3  
  1         45  
3 1     1   7 use warnings;
  1         2  
  1         39  
4 1     1   670 use SOAP::WSDL::XSD::Schema::Builtin;
  1         3  
  1         27  
5 1     1   6 use Class::Std::Fast::Storable;
  1         2  
  1         5  
6 1     1   130 use base qw(SOAP::WSDL::Base);
  1         3  
  1         493  
7              
8             our $VERSION = $SOAP::WSDL::VERSION;
9              
10             my %schema_of :ATTR(:name :default<[]>);
11              
12             sub START {
13 1     1 0 8 my ($self, $ident, $args_of) = @_;
14 1         17 $self->push_schema( SOAP::WSDL::XSD::Schema::Builtin->new() );
15 1         15 return $self;
16             }
17              
18             sub find_type {
19 0     0 0 0 my ($self, $ns, $name) = @_;
20 0 0       0 ($ns, $name) = @{ $ns } if ref $ns; # allow passing list refs
  0         0  
21 0         0 foreach my $schema (@{ $schema_of{ ident $self } }) {
  0         0  
22 0         0 my $type = $schema->find_type($ns, $name);
23 0 0       0 return $type if $type;
24             }
25 0         0 return;
26             }
27              
28             sub find_attribute {
29 3     3 0 19 my ($self, $ns, $name) = @_;
30 3 100       12 ($ns, $name) = @{ $ns } if ref $ns; # allow passing list refs
  1         4  
31 3         4 foreach my $schema (@{ $schema_of{ ident $self } }) {
  3         11  
32 6         56 my $type = $schema->find_attribute($ns, $name);
33 6 100       160 return $type if $type;
34             }
35 1         5 return;
36             }
37              
38             sub find_element {
39 1     1 0 2 my ($self, $ns, $name) = @_;
40 1 50       4 ($ns, $name) = @{ $ns } if ref $ns; # allow passing list refs
  0         0  
41 1         2 foreach my $schema (@{ $schema_of{ ident $self } }) {
  1         3  
42 2         16 my $type = $schema->find_element($ns, $name);
43 2 50       6 return $type if $type;
44             }
45 1         4 return;
46             }
47              
48             1;