| 1 | package Rapi::Blog::Scaffold::Set; | ||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 1 | ▶ | use RapidApp::Util qw(:all); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use Rapi::Blog::Util; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | ▶ | use List::Util; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 1 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 1 | ▶ | use Types::Standard ':all'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 1 | has 'Scaffolds', is => 'ro', required => 1, isa => ArrayRef[InstanceOf['Rapi::Blog::Scaffold']]; | |||||||||
| 13 | |||||||||||
| 14 | 0 | ▶ | sub count { scalar(@{(shift)->Scaffolds}) } | ||||||||
|
Subroutine
count: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 15 | 0 | ▶ | sub all { @{(shift)->Scaffolds} } | ||||||||
|
Subroutine
all: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 16 | 0 | ▶ | sub first { (shift)->Scaffolds->[0] } | ||||||||
|
Subroutine
first: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 17 | |||||||||||
| 18 | |||||||||||
| 19 | 0 | ▶ | sub BUILD { | ||||||||
|
Subroutine
BUILD: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 20 | 0 | my $self = shift; | |||||||||
| 21 | |||||||||||
| 22 | 0 | ▶ | $self->first or die "At least one Scaffold is required"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | } | ||||||||||
| 24 | |||||||||||
| 25 | 0 | ▶ | sub first_with_param { | ||||||||
|
Subroutine
first_with_param: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 26 | 0 | my $self = shift; | |||||||||
| 27 | 0 | ▶ | my $param = shift or die "no param supplied"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | |||||||||||
| 29 | 0 | ▶ | List::Util::first { $_->config->$param } $self->all | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 30 | } | ||||||||||
| 31 | |||||||||||
| 32 | 0 | ▶ | sub first_with_param_file { | ||||||||
|
Subroutine
first_with_param_file: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 33 | 0 | my $self = shift; | |||||||||
| 34 | 0 | ▶ | my $param = shift or die "no param supplied"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | |||||||||||
| 36 | 0 | ▶ | List::Util::first { | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 37 | 0 | my $val = $_->config->$param; | |||||||||
| 38 | 0 | ▶ | if($val) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 39 | 0 | my $File = $_->dir->file($val); | |||||||||
| 40 | 0 | -f $File | |||||||||
| 41 | } | ||||||||||
| 42 | else { | ||||||||||
| 43 | 0 | 0 | |||||||||
| 44 | } | ||||||||||
| 45 | 0 | } $self->all | |||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | 0 | ▶ | sub first_config_value { | ||||||||
|
Subroutine
first_config_value: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 49 | 0 | my ($self, $param) = @_; | |||||||||
| 50 | |||||||||||
| 51 | 0 | ▶ | my $Scaffold = $self->first_with_param($param) or return undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 52 | 0 | $Scaffold->config->$param | |||||||||
| 53 | } | ||||||||||
| 54 | |||||||||||
| 55 | 0 | ▶ | sub first_config_value_file { | ||||||||
|
Subroutine
first_config_value_file: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 56 | 0 | my ($self, $param) = @_; | |||||||||
| 57 | |||||||||||
| 58 | 0 | ▶ | my $Scaffold = $self->first_with_param_file($param) or return undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 59 | 0 | $Scaffold->config->$param | |||||||||
| 60 | } | ||||||||||
| 61 | |||||||||||
| 62 | 0 | ▶ | sub first_config_value_filepath { | ||||||||
|
Subroutine
first_config_value_filepath: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 63 | 0 | my ($self, $param) = @_; | |||||||||
| 64 | |||||||||||
| 65 | 0 | ▶ | my $Scaffold = $self->first_with_param_file($param) or return undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 66 | 0 | $Scaffold->dir->file( $Scaffold->config->$param )->stringify | |||||||||
| 67 | } | ||||||||||
| 68 | |||||||||||
| 69 | |||||||||||
| 70 | |||||||||||
| 71 | |||||||||||
| 72 | 1 | 1; | |||||||||