Completed
Push — master ( 1b8ca6...90d75c )
by Mahmoud
03:54
created

TestsUploadHelperTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 32
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getTestingFile() 0 6 1
A getTestingImage() 0 4 1
1
<?php
2
3
namespace App\Ship\Features\Tests\PhpUnit;
4
5
use Illuminate\Http\UploadedFile;
6
7
/**
8
 * Class TestsUploadHelperTrait
9
 *
10
 * * Tests helper for uploading files.
11
 *
12
 * @author  Mahmoud Zalt  <[email protected]>
13
 */
14
trait TestsUploadHelperTrait
15
{
16
17
    /**
18
     * @param        $fileName
19
     * @param        $stubDirPath
20
     * @param string $mimeType
21
     * @param null   $size
22
     *
23
     * @return  \Illuminate\Http\UploadedFile
24
     */
25
    public function getTestingFile($fileName, $stubDirPath, $mimeType = 'text/plain', $size = null)
26
    {
27
        $file = $stubDirPath . $fileName;
28
29
        return new UploadedFile($file, $fileName, $mimeType, $size, null, true); // null = null | $testMode = true
0 ignored issues
show
Unused Code Comprehensibility introduced by
36% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
30
    }
31
32
    /**
33
     * @param        $imageName
34
     * @param        $stubDirPath
35
     * @param string $mimeType
36
     * @param null   $size
37
     *
38
     * @return  \Illuminate\Http\UploadedFile
39
     */
40
    public function getTestingImage($imageName, $stubDirPath, $mimeType = 'image/jpeg', $size = null)
41
    {
42
        return $this->getTestingFile($imageName, $stubDirPath, $mimeType, $size);
43
    }
44
45
}
46