| 1 | # Copyright (C) 2017 Koha-Suomi | ||||||||||
| 2 | # | ||||||||||
| 3 | # This file is part of Pootle-Client. | ||||||||||
| 4 | |||||||||||
| 5 | package Pootle::Resource::Project; | ||||||||||
| 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::Project | ||||||||||
| 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 | checkstyle => 1, #eg. "standard", | ||||||||||
| 33 | code => 1, #eg. "firefox", | ||||||||||
| 34 | description => 1, #eg. "", | ||||||||||
| 35 | fullname => 1, #eg. "Firefox 22 (Aurora)", | ||||||||||
| 36 | ignoredfiles => 1, #eg. "", | ||||||||||
| 37 | localfiletype => 1, #eg. "po", | ||||||||||
| 38 | resource_uri => 1, #eg. "/api/v1/projects/4/", | ||||||||||
| 39 | source_language => 1, #eg. "/api/v1/languages/2/", | ||||||||||
| 40 | translation_projects => { type => ARRAYREF }, #eg. [ "/api/v1/translation-projects/71/", ... ], | ||||||||||
| 41 | treestyle => 1, #eg. "nongnu", | ||||||||||
| 42 | }); | ||||||||||
| 43 | 0 | my $s = bless(\%self, $class); | |||||||||
| 44 | |||||||||||
| 45 | 0 | return $s; | |||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | 0 | ▶ | sub checkstyle($s) { return $s->{checkstyle} } | ||||||||
|
Subroutine
checkstyle: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 49 | 0 | ▶ | sub code($s) { return $s->{code} } | ||||||||
|
Subroutine
code: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 50 | 0 | ▶ | sub description($s) { return $s->{description} } | ||||||||
|
Subroutine
description: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 51 | 0 | ▶ | sub fullname($s) { return $s->{fullname} } | ||||||||
|
Subroutine
fullname: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 52 | 0 | ▶ | sub ignoredfiles($s) { return $s->{ignoredfiles} } | ||||||||
|
Subroutine
ignoredfiles: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 53 | 0 | ▶ | sub localfiletype($s) { return $s->{localfiletype} } | ||||||||
|
Subroutine
localfiletype: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 54 | 0 | ▶ | sub resource_uri($s) { return $s->{resource_uri} } | ||||||||
|
Subroutine
resource_uri: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 55 | 0 | ▶ | sub source_language($s) { return $s->{source_language} } | ||||||||
|
Subroutine
source_language: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 56 | 0 | ▶ | sub translation_projects($s) { return $s->{translation_projects} } | ||||||||
|
Subroutine
translation_projects: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 57 | 0 | ▶ | sub treestyle($s) { return $s->{treestyle} } | ||||||||
|
Subroutine
treestyle: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 58 | |||||||||||
| 59 | =head2 Accessors | ||||||||||
| 60 | |||||||||||
| 61 | =over 4 | ||||||||||
| 62 | |||||||||||
| 63 | =item B<checkstyle> | ||||||||||
| 64 | |||||||||||
| 65 | =item B<code> | ||||||||||
| 66 | |||||||||||
| 67 | =item B<description> | ||||||||||
| 68 | |||||||||||
| 69 | =item B<fullname> | ||||||||||
| 70 | |||||||||||
| 71 | =item B<ignoredfiles> | ||||||||||
| 72 | |||||||||||
| 73 | =item B<localfiletype> | ||||||||||
| 74 | |||||||||||
| 75 | =item B<resource_uri> | ||||||||||
| 76 | |||||||||||
| 77 | =item B<source_language> | ||||||||||
| 78 | |||||||||||
| 79 | =item B<translation_projects> | ||||||||||
| 80 | |||||||||||
| 81 | =item B<treestyle> | ||||||||||
| 82 | |||||||||||
| 83 | =cut | ||||||||||
| 84 | |||||||||||
| 85 | 1 | 1; | |||||||||