File Coverage

blib/lib/Data/Format/Pretty/PHP.pm
Criterion Covered Total %
statement 15 16 93.7
branch n/a
condition 1 2 50.0
subroutine 5 6 83.3
pod 1 2 50.0
total 22 26 84.6


line stmt bran cond sub pod time code
1             package Data::Format::Pretty::PHP;
2              
3 1     1   488 use 5.010;
  1         3  
  1         29  
4 1     1   4 use strict;
  1         2  
  1         20  
5 1     1   4 use warnings;
  1         2  
  1         23  
6              
7 1     1   740 use Data::Dump::PHP qw(dump_php);
  1         7837  
  1         178  
8              
9             require Exporter;
10             our @ISA = qw(Exporter);
11             our @EXPORT_OK = qw(format_pretty);
12              
13             our $VERSION = '0.03'; # VERSION
14              
15 0     0 0 0 sub content_type { "application/x-httpd-php-source" }
16              
17             sub format_pretty {
18 1     1 1 1052 my ($data, $opts) = @_;
19 1   50     5 $opts //= {};
20 1         6 dump_php($data);
21             }
22              
23             1;
24             # ABSTRACT: Pretty-print data structure as PHP code
25              
26              
27             =pod
28              
29             =head1 NAME
30              
31             Data::Format::Pretty::PHP - Pretty-print data structure as PHP code
32              
33             =head1 VERSION
34              
35             version 0.03
36              
37             =head1 SYNOPSIS
38              
39             use Data::Format::Pretty::PHP qw(format_pretty);
40             print format_pretty($data);
41              
42             Some example output:
43              
44             =over 4
45              
46             =item * format_pretty({a=>1, b=>2})
47              
48             array( "a" => 1, "b" => 2 )
49              
50             =head1 DESCRIPTION
51              
52             This module uses L to encode data as PHP code.
53              
54             =head1 FUNCTIONS
55              
56             =head2 format_pretty($data, \%opts)
57              
58             Return formatted data structure. Currently there are no known formatting
59             options.
60              
61             =head1 SEE ALSO
62              
63             L
64              
65             L
66              
67             =head1 AUTHOR
68              
69             Steven Haryanto
70              
71             =head1 COPYRIGHT AND LICENSE
72              
73             This software is copyright (c) 2012 by Steven Haryanto.
74              
75             This is free software; you can redistribute it and/or modify it under
76             the same terms as the Perl 5 programming language system itself.
77              
78             =cut
79              
80              
81             __END__