Passed
Push — master ( 7d22f9...1460f7 )
by Jean Paul
01:51
created

ParentTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 10
rs 10
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A getEnvironmentVariable() 0 8 4
1
<?php declare( strict_types=1 );
2
3
namespace Coco\SourceWatcher\Tests\Common;
4
5
use PHPUnit\Framework\TestCase;
6
7
/**
8
 * Class ParentTest
9
 *
10
 * @package Coco\SourceWatcher\Tests\Common
11
 */
12
class ParentTest extends TestCase
13
{
14
    protected function getEnvironmentVariable ( string $variableName, $default, $castingFunctionName = null )
15
    {
16
        if ( !empty( $castingFunctionName ) ) {
17
            return array_key_exists( $variableName, $_ENV ) ? call_user_func( $castingFunctionName,
18
                $_ENV[$variableName] ) : $default;
19
        }
20
21
        return array_key_exists( $variableName, $_ENV ) ? $_ENV[$variableName] : $default;
22
    }
23
}
24