Plist/Foundation/NSObject.pm

filter: Statementstmt 100% 42 / 42 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 10 / 10 Podpod 0.0% 0 / 5 totaltotal 90.1% 55 / 61 CC 4 SCAR 4.8
CC
4
Cov
98%
serialize
3.0
serialize_class
2.0
BEGIN
1.0
CRAP 1.6
« Plist/Foundation/NSString.pm ↑ Summary Plist/Reader.pm »
1 package Data::Plist::Foundation::NSObject;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Class::ISA;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use UNIVERSAL::isa;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Scalar::Util qw//;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 2 ▶sub init {
Subroutine init: called CC=1 SCAR=0.0
Pod undocumented
10 2 my $self = shift;
11 }
12  
13 2 ▶sub replacement {
Subroutine replacement: called CC=1 SCAR=0.0
Pod undocumented
14 2 my $self = shift;
15 2 $self->init;
16 2 return $self;
17 }
18  
19 4 ▶sub serialize_class {
Subroutine serialize_class: called CC=2 SCAR=7.0
Pod undocumented
20 4 my $self = shift;
21 4 ▶ $self = ref $self if ref $self;
Branch: 1 branch
BranchTrueFalseTotal
if ref $self 4 0 4
22  
23 4 my $short = $self;
24 4 $short =~ s/^Data::Plist::Foundation:://;
25 return [
26 UID => [
27 dict => {
28 '$classes' => [
29 array => [
30 9 map { s/^Data::Plist::Foundation:://; [ string => $_ ] }
31 4 grep { $_->isa("Data::Plist::Foundation::NSObject") }
32 Class::ISA::self_and_super_path($self)
33 ]
34 ],
35 '$classname' => [ string => $short ],
36 }
37 ]
38 ];
39 }
40  
41 1 ▶sub serialize_equiv {
Subroutine serialize_equiv: called CC=1 SCAR=0.0
Pod undocumented
42 1 my $self = shift;
43 1 return { %{$self} };
44 }
45  
46 4 ▶sub serialize {
Subroutine serialize: called CC=3 SCAR=11.0
Pod undocumented
47 4 my $self = shift;
48 4 my %dict;
49 4 $dict{'$class'} = $self->serialize_class;
50 4 my $equiv = $self->serialize_equiv;
51 4 for my $key ( keys %{$equiv} ) {
52 5 my $value = Data::Plist::Writer->serialize_value( $equiv->{$key} );
53 5 ▶ if ( $value->[0] =~ /^(data|integer|real|true|false)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($value->[0] =~ /^(data|integer|real|true|false)$/) { } 2 3 5
54 2 $dict{$key} = $value;
55 } else {
56 3 $dict{$key} = [ UID => $value ];
57 }
58 }
59 4 return [ dict => \%dict ];
60 }
61  
62 1 1;
« Plist/Foundation/NSString.pm ↑ Summary Plist/Reader.pm »