| 1 | # Copyright (C) 2017 Koha-Suomi | ||||||||||
| 2 | # | ||||||||||
| 3 | # This file is part of Pootle-Client. | ||||||||||
| 4 | |||||||||||
| 5 | package Pootle::Resource::Store; | ||||||||||
| 6 | |||||||||||
| 7 | 1 | ▶ | use Modern::Perl '2015'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 1 | ▶ | use utf8; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | binmode STDOUT, ':encoding(UTF-8)'; | |||||||||
| 10 | 1 | binmode STDERR, ':encoding(UTF-8)'; | |||||||||
| 11 | 1 | ▶ | use feature 'signatures'; no warnings "experimental::signatures"; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 1 | ▶ | use Carp::Always; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 1 | ▶ | use Try::Tiny; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | 1 | ▶ | use Scalar::Util qw(blessed); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | |||||||||||
| 16 | =head2 Pootle::Resource::Store | ||||||||||
| 17 | |||||||||||
| 18 | Pootle object | ||||||||||
| 19 | |||||||||||
| 20 | =cut | ||||||||||
| 21 | |||||||||||
| 22 | 1 | ▶ | use base('Pootle::Resource'); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 23 | |||||||||||
| 24 | 1 | ▶ | use Params::Validate qw(:all); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 25 | |||||||||||
| 26 | 1 | ▶ | use Pootle::Logger; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 27 | 1 | my $l = bless({}, 'Pootle::Logger'); #Lazy load package logger this way to avoid circular dependency issues with logger includes from many packages | |||||||||
| 28 | |||||||||||
| 29 | 0 | ▶ | sub new($class, @params) { | ||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 30 | 0 | ▶ | $l->debug("Initializing ".__PACKAGE__." with parameters: ".$l->flatten(@params)) if $l->is_debug(); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | 0 | my %self = validate(@params, { | |||||||||
| 32 | file => 1, #eg. "/media/Firefox/fr/chrome/global/languageNames.properties.po" | ||||||||||
| 33 | name => 1, #eg. "languageNames.properties.po" | ||||||||||
| 34 | pending => 0, #eg. null | ||||||||||
| 35 | pootle_path => 1, #eg. "fr/firefox/chrome/global/languageNames.properties.po" | ||||||||||
| 36 | resource_uri => 1, #eg. "/api/v1/stores/76/" | ||||||||||
| 37 | state => 1, #eg. 2 | ||||||||||
| 38 | sync_time => 1, #eg. "2013-03-15T20:10:35.070238" | ||||||||||
| 39 | tm => 0, #eg. null | ||||||||||
| 40 | translation_project => 1, #eg. "/api/v1/translation-projects/65/" | ||||||||||
| 41 | units => 1, #eg. [ '/api/v1/units/70316/', ... ] | ||||||||||
| 42 | }); | ||||||||||
| 43 | 0 | my $s = bless(\%self, $class); | |||||||||
| 44 | |||||||||||
| 45 | 0 | return $s; | |||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | 0 | ▶ | sub file($s) { return $s->{file} } | ||||||||
|
Subroutine
file: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 49 | 0 | ▶ | sub name($s) { return $s->{name} } | ||||||||
|
Subroutine
name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 50 | 0 | ▶ | sub pending($s) { return $s->{pending} } | ||||||||
|
Subroutine
pending: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 51 | 0 | ▶ | sub pootle_path($s) { return $s->{pootle_path} } | ||||||||
|
Subroutine
pootle_path: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 52 | 0 | ▶ | sub resource_uri($s) { return $s->{resource_uri} } | ||||||||
|
Subroutine
resource_uri: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 53 | 0 | ▶ | sub state($s) { return $s->{state} } | ||||||||
|
Subroutine
state: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 54 | 0 | ▶ | sub sync_time($s) { return $s->{sync_time} } | ||||||||
|
Subroutine
sync_time: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 55 | 0 | ▶ | sub tm($s) { return $s->{tm} } | ||||||||
|
Subroutine
tm: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 56 | 0 | ▶ | sub translation_project($s) { return $s->{translation_project} } | ||||||||
|
Subroutine
translation_project: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 57 | 0 | ▶ | sub units($s) { return $s->{units} } | ||||||||
|
Subroutine
units: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 58 | |||||||||||
| 59 | =head2 Accessors | ||||||||||
| 60 | |||||||||||
| 61 | =over 4 | ||||||||||
| 62 | |||||||||||
| 63 | =item B<file> | ||||||||||
| 64 | |||||||||||
| 65 | =item B<name> | ||||||||||
| 66 | |||||||||||
| 67 | =item B<pending> | ||||||||||
| 68 | |||||||||||
| 69 | =item B<pootle_path> | ||||||||||
| 70 | |||||||||||
| 71 | =item B<resource_uri> | ||||||||||
| 72 | |||||||||||
| 73 | =item B<state> | ||||||||||
| 74 | |||||||||||
| 75 | =item B<sync_time> | ||||||||||
| 76 | |||||||||||
| 77 | =item B<tm> | ||||||||||
| 78 | |||||||||||
| 79 | =item B<translation_project> | ||||||||||
| 80 | |||||||||||
| 81 | =item B<units> | ||||||||||
| 82 | |||||||||||
| 83 | =cut | ||||||||||
| 84 | |||||||||||
| 85 | 1 | 1; | |||||||||