Utils/OTRS4.pm

filter: Statementstmt 100% 27 / 27 Branchbran 100% 6 / 6 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 7 / 7 Podpod 100% 2 / 2 totaltotal 100% 45 / 45 CC 5 SCAR 8.2
CC
5
Cov
100%
packagesetup
4.0
filecheck
2.0
BEGIN
1.0
CRAP 2.3
« Utils/OTRS3.pm ↑ Summary
1 package OPM::Maker::Utils::OTRS4;
2 33 $OPM::Maker::Utils::OTRS4::VERSION = '1.2.0';
3 # ABSTRACT: helper functions for ((OTRS)) Community Edition >= 4
4  
5 33 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 33 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 33 ▶use List::Util qw(first);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 33 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 21 ▶sub packagesetup {
Subroutine packagesetup: called CC=4 SCAR=13.9
Pod documented
12 21 my ($class, $type, $version, $function, $runtype, $package) = @_;
13  
14 21 ▶ $version = $version ? ' Version="' . $version . '"' : '';
Branch: 1 branch
BranchTrueFalseTotal
$version ? : 3 18 21
15  
16 21 ▶ $runtype //= 'post';
Condition100%2/2
$runtype //= "post"
l!l
318
MC/DC100%1/1
$runtype //= "post"
$runtype
Truth table100%2/2
A
A= $runtype
Aresult
11
00
17  
18 21 ▶ if ( $package ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($package) { } 2 19 21
19 2 $package = sprintf "'%s'", $package;
20 }
21 else {
22 19 $package = '$Param{Structure}->{Name}->{Content}';
23 }
24  
25 21 return qq~ <$type Type="$runtype"$version><![CDATA[
26 \$Kernel::OM->Get('var::packagesetup::' . $package )->$function();
27 ]]></$type>~;
28 }
29  
30 13 ▶sub filecheck {
Subroutine filecheck: called CC=2 SCAR=6.9
Pod documented
31 13 my ($class, $files) = @_;
32  
33 13 ▶ if ( first{ $_ =~ m{Kernel/Output/HTML/[^/]+/.*?\.dtl\z} }@{$files} ) {
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
if (&first(sub { $_ =~ m[Kernel/Output/HTML/[^/]+/.*?\.dtl\z]; } , @{$files;})) 1 12 13
34 1 carp "The old template engine was replaced with Template::Toolkit. Please use bin/otrs.MigrateDTLToTT.pl.\n";
35 }
36  
37 13 return 1;
38 }
39  
40 33 1;
41  
42 __END__
« Utils/OTRS3.pm ↑ Summary