IOC/Service/Literal.pm

filter: Statementstmt 100% 32 / 32 Branchbran 100% 4 / 4 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 11 / 11 Podpod 100% 4 / 4 totaltotal 92.8% 52 / 56 CC 4 SCAR 4.6
CC
4
Cov
95%
_init
3.0
new
2.0
BEGIN
1.0
CRAP 1.6
« IOC/Service/ConstructorInjection.pm ↑ Summary IOC/Service/Parameterized.pm »
1  
2 package IOC::Service::Literal;
3  
4 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 10 our $VERSION = '0.01';
8  
9 10 ▶use Scalar::Util qw(blessed);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 10 ▶use IOC::Exceptions;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 10 ▶use base 'IOC::Service';
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 9 ▶sub new {
Subroutine new: called CC=2 SCAR=7.1
Pod documented
16 9 my ($_class, $name, $literal) = @_;
17 9 ▶ my $class = ref($_class) || $_class;
Condition33%1/3
ref $_class || $_class
l!l&&r!l&&!r
090
MC/DC0%0/2
ref $_class || $_class
ref $_class $_class
Truth table33%1/3
A || B
A= ref $_classB= $_class
ABresult
1X1
011
000
18 9 my $service = {};
19 9 bless($service, $class);
20 9 $service->_init($name, $literal);
21 7 return $service;
22 }
23  
24 9 ▶sub _init {
Subroutine _init: called CC=3 SCAR=11.0
25 9 my ($self, $name, $literal) = @_;
26 9 ▶ (defined($name)) || throw IOC::InsufficientArguments "Service object cannot be created without a name";
Branch: 1 branch
BranchTrueFalseTotal
defined $name or "IOC::InsufficientArguments"->throw("Service object cannot be created without a name") 8 1 9
27 8 ▶ (defined($literal))
Branch: 1 branch
BranchTrueFalseTotal
defined $literal or "IOC::InsufficientArguments"->throw("Service::Literal object cannot be created without value") 7 1 8
28 || throw IOC::InsufficientArguments "Service::Literal object cannot be created without value";
29 # set the defaults
30 7 $self->{_instance} = $literal;
31 # assign constructor args
32 7 $self->{name} = $name;
33 # No block in this one
34 ## $self->{block} = undef;
35 # No container in this one either
36 ## $self->{container} = undef;
37 }
38  
39 15 ▶sub instance { (shift)->{_instance} }
Subroutine instance: called CC=1 SCAR=0.0
Pod documented
40  
41 # no-ops
42 7 ▶sub setContainer { () }
Subroutine setContainer: called CC=1 SCAR=0.0
Pod documented
43 1 ▶sub removeContainer { () }
Subroutine removeContainer: called CC=1 SCAR=0.0
Pod documented
44 3 ▶sub DESTROY { () }
Subroutine DESTROY: called CC=1 SCAR=0.0
45  
46 10 1;
47  
48 __END__
« IOC/Service/ConstructorInjection.pm ↑ Summary IOC/Service/Parameterized.pm »