Command::tempnam()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 2
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
/**
3
* @author SignpostMarv
4
*/
5
declare(strict_types=1);
6
7
namespace SignpostMarv\DaftFramework\Symfony\Console\Command;
8
9
use SignpostMarv\DaftFramework\AttachDaftFramework;
10
use Symfony\Component\Console\Command\Command as Base;
11
use Symfony\Component\Console\Output\OutputInterface;
12
13
abstract class Command extends Base
14
{
15
	use AttachDaftFramework;
16
17 1
	protected static function tempnam() : string
18
	{
19 1
		return (string) realpath((string) tempnam(sys_get_temp_dir(), static::class));
20
	}
21
22 2
	final protected static function tempnamCheck(OutputInterface $output) : ? string
23
	{
24 2
		$tempnam = static::tempnam();
25
26 2
		if (is_dir($tempnam) || ! is_file($tempnam) || ! is_writable($tempnam)) {
27 1
			$output->writeln('could not get temporary filename!');
28
29 1
			return null;
30
		}
31
32 1
		return $tempnam;
33
	}
34
}
35