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