| 1 | # Copyrights 2011-2017 by [Mark Overmeer]. | ||||||||||||||||||||||||||||
| 2 | # For other contributors see ChangeLog. | ||||||||||||||||||||||||||||
| 3 | # See the manual pages for details on the licensing terms. | ||||||||||||||||||||||||||||
| 4 | # Pod stripped from pm file by OODoc 2.02. | ||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | package XML::Compile::WSS::Timestamp; | ||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use vars '$VERSION'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 2 | $VERSION = '1.14'; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use base 'XML::Compile::WSS'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 2 | ▶ | use Log::Report 'xml-compile-wss'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 2 | ▶ | use XML::Compile::WSS::Util qw/WSU_10/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | sub init($) | ||||||||||||||||||||||||||||
| 20 | 2 | ▶ | { my ($self, $args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
init: called CC=3 SCAR=11.3
Pod
undocumented
| |||||||||||||||||||||||||||||
| 21 | 2 | ▶ | $args->{wss_version} ||= '1.1'; | ||||||||||||||||||||||||||
|
Condition50%1/2
$args->{"wss_version"} ||= "1.1"
MC/DC0%0/1
$args->{"wss_version"} ||= "1.1"
$args->{"wss_version"}
Truth table50%1/2
A
A= $args->{"wss_version"}
| |||||||||||||||||||||||||||||
| 22 | 2 | $self->SUPER::init($args); | |||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 2 | $self->{XCWT_created} = $args->{created}; | |||||||||||||||||||||||||||
| 25 | 2 | $self->{XCWT_expires} = $args->{expires}; | |||||||||||||||||||||||||||
| 26 | 2 | $self->{XCWT_lifetime} = $args->{lifetime}; | |||||||||||||||||||||||||||
| 27 | 2 | ▶ | $self->{XCWT_wsu_id} = $args->{wsu_Id} || $args->{wsu_id}; | ||||||||||||||||||||||||||
|
Condition33%1/3
$args->{'wsu_Id'} || $args->{'wsu_id'}
MC/DC0%0/2
$args->{'wsu_Id'} || $args->{'wsu_id'}
$args->{'wsu_Id'}
$args->{'wsu_id'}
Truth table33%1/3
A || B
A= $args->{'wsu_Id'}B= $args->{'wsu_id'}
| |||||||||||||||||||||||||||||
| 28 | 2 | $self; | |||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | #---------------------------------- | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 0 | ▶ | sub created() {shift->{XCWT_created}} | ||||||||||||||||||||||||||
|
Subroutine
created: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 34 | 0 | ▶ | sub expires() {shift->{XCWT_expires}} | ||||||||||||||||||||||||||
|
Subroutine
expires: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 35 | 0 | ▶ | sub lifetime() {shift->{XCWT_lifetime}} | ||||||||||||||||||||||||||
|
Subroutine
lifetime: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 36 | 3 | ▶ | sub wsuId() {shift->{XCWT_wsu_id}} | ||||||||||||||||||||||||||
|
Subroutine
wsuId: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | sub timestamps() | ||||||||||||||||||||||||||||
| 40 | 3 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
timestamps: called CC=6 SCAR=21.8
Pod
documented
| |||||||||||||||||||||||||||||
| 41 | 3 | my ($c, $e, $l) = @{$self}{ qw/XCWT_created XCWT_expires XCWT_lifetime/ }; | |||||||||||||||||||||||||||
| 42 | 3 | my ($expires); | |||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 3 | ▶ | defined $c or $c = time; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 45 | 3 | ▶ | my $created = $c eq '' ? undef : $self->dateTime($c); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 3 | ▶ | if(!$e && defined $l) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $e and defined $l
MC/DC0%0/2
not $e and defined $l
not $e
defined $l
Truth table33%1/3
not(A) and B
A= not $eB= defined $l
| |||||||||||||||||||||||||||||
| 48 | 0 | ▶ | { $c !~ m/\D/ or error "lifetime only when created is in seconds"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 49 | 0 | $e = $c + $l; | |||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | 3 | ($created, $self->dateTime($e)); | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | sub prepareWriting($) | ||||||||||||||||||||||||||||
| 55 | 2 | ▶ | { my ($self, $schema) = @_; | ||||||||||||||||||||||||||
|
Subroutine
prepareWriting: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 56 | 2 | $self->SUPER::prepareWriting($schema); | |||||||||||||||||||||||||||
| 57 | 2 | ▶ | return if $self->{XCWT_stamp}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 2 | my $ts_type = $schema->findName('wsu:Timestamp') ; | |||||||||||||||||||||||||||
| 60 | 2 | my @hooks = $self->writerHookWsuId('wsu:TimestampType'); | |||||||||||||||||||||||||||
| 61 | 2 | my $make_ts = $schema->writer($ts_type, include_namespaces => 1 | |||||||||||||||||||||||||||
| 62 | , hooks => \@hooks); | ||||||||||||||||||||||||||||
| 63 | 2 | $schema->prefixFor(WSU_10); | |||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 3 | ▶ | $self->{XCWT_stamp} = sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 66 | 3 | my ($doc, $data) = @_; | |||||||||||||||||||||||||||
| 67 | 3 | my ($created, $expires) = $self->timestamps; | |||||||||||||||||||||||||||
| 68 | 3 | $data->{$ts_type} = $make_ts->($doc, | |||||||||||||||||||||||||||
| 69 | { wsu_Id => $self->wsuId | ||||||||||||||||||||||||||||
| 70 | , wsu_Created => $created | ||||||||||||||||||||||||||||
| 71 | , wsu_Expires => $expires | ||||||||||||||||||||||||||||
| 72 | }); | ||||||||||||||||||||||||||||
| 73 | 3 | $data; | |||||||||||||||||||||||||||
| 74 | 2 | }; | |||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | sub create($$) | ||||||||||||||||||||||||||||
| 78 | 3 | ▶ | { my ($self, $doc, $data) = @_; | ||||||||||||||||||||||||||
|
Subroutine
create: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 79 | 3 | $self->SUPER::create($doc, $data); | |||||||||||||||||||||||||||
| 80 | 3 | $self->{XCWT_stamp}->($doc, $data); | |||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | 2 | 1; | |||||||||||||||||||||||||||