Image.pm

filter: Statementstmt 94.4% 34 / 36 Branchbran 100% 4 / 4 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 9 / 9 Podpod 100% 3 / 3 totaltotal 96.4% 55 / 57 CC 4 SCAR 7.0
CC
4
Cov
95%
new
4.0
image
1.0
image_url
1.0
CRAP 2.0
↑ Summary Image/BricklinkCom.pm »
1 package Lego::Part::Image;
2  
3 21 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 21 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 21 ▶use Class::Utils qw(set_params);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 21 ▶use Error::Pure qw(err);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 21 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 21 ▶use Scalar::Util qw(blessed);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 # Constants.
12 21 Readonly::Scalar our $EMPTY_STR => q{};
13  
14 21 our $VERSION = 0.06;
15  
16 # Constructor.
17 41 ▶sub new {
Subroutine new: called CC=4 SCAR=13.9
Pod documented
18 41 my ($class, @params) = @_;
19  
20 # Create object.
21 41 my $self = bless {}, $class;
22  
23 # Part object.
24 41 $self->{'part'} = undef;
25  
26 # Process parameters.
27 41 set_params($self, @params);
28  
29 # Check part object.
30 31 ▶ if (! defined $self->{'part'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"part"}) 5 26 31
31 5 err "Parameter 'part' is required.";
32 }
33 26 ▶ if (! blessed($self->{'part'})
Branch: 1 branch
BranchTrueFalseTotal
unless (builtin::blessed($self->{"part"}) and $self->{"part"}->isa("Lego::Part")) 10 16 26
Condition100%3/3
builtin::blessed($self->{"part"}) and $self->{"part"}->isa("Lego::Part")
!ll&&!rl&&r
5516
MC/DC100%2/2
builtin::blessed($self->{"part"}) and $self->{"part"}->isa("Lego::Part")
builtin::blessed($self->{"part"}) $self->{"part"}->isa("Lego::Part")
Truth table100%3/3
A and B
A= builtin::blessed($self->{"part"})B= $self->{"part"}->isa("Lego::Part")
ABresult
0X0
100
111
34 || ! $self->{'part'}->isa('Lego::Part')) {
35  
36 10 err "Parameter 'part' must be Lego::Part object.";
37 }
38  
39 # Object.
40 16 return $self;
41 }
42  
43 # Get image.
44 1 ▶sub image {
Subroutine image: called CC=1 SCAR=0.4
Pod documented
45 1 my $self = shift;
46  
47 # TODO Implement getting of image with cache.
48 1 err "This is abstract class. image() method not implemented.";
49  
50 0 return;
51 }
52  
53 # Get image URL.
54 1 ▶sub image_url {
Subroutine image_url: called CC=1 SCAR=0.4
Pod documented
55 1 my $self = shift;
56  
57 1 err "This is abstract class. image_url() method not implemented.";
58  
59 0 return;
60 }
61  
62 21 1;
63  
64 __END__
↑ Summary Image/BricklinkCom.pm »