Passed
Push — master ( a15adc...3eeabd )
by SignpostMarv
05:36
created

Command::tempnam()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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
    /**
18
    * @return string|false
19
    */
20 2
    protected static function tempnam()
21
    {
22 2
        return tempnam(sys_get_temp_dir(), static::class);
23
    }
24
25
    /**
26
    * @param string|false $tempnam
27
    *
28
    * @return string|false
29
    */
30 4
    final protected static function tempnamCheck($tempnam, OutputInterface $output)
0 ignored issues
show
Unused Code introduced by
The parameter $tempnam is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

30
    final protected static function tempnamCheck(/** @scrutinizer ignore-unused */ $tempnam, OutputInterface $output)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
31
    {
32 4
        $tempnam = static::tempnam();
33
34 4
        if ( ! is_string($tempnam)) {
0 ignored issues
show
introduced by
The condition is_string($tempnam) is always true.
Loading history...
35 2
            $output->writeln('could not get temporary filename!');
36
        }
37
38 4
        return $tempnam;
39
    }
40
}
41