PharFileExtractor   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 19
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A extract() 0 9 1
1
<?php
2
3
namespace Dock\IO;
4
5
class PharFileExtractor
6
{
7
    /**
8
     * Extract a file from the PHAR archive to make it accessible from system commands.
9
     *
10
     * @param string $filePath
11
     *
12
     * @return string
13
     */
14
    public function extract($filePath)
15
    {
16
        $dockerRouteFileContents = file_get_contents($filePath);
17
18
        $temporaryFile = tempnam(sys_get_temp_dir(), 'PharFile');
19
        file_put_contents($temporaryFile, $dockerRouteFileContents);
20
21
        return $temporaryFile;
22
    }
23
}
24