Passed
Push — master ( 1438ee...6641ad )
by Quentin
06:42 queued 12s
created

Glide::makeCloudSource()   A

Complexity

Conditions 5
Paths 4

Size

Total Lines 17
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 5
eloc 8
c 1
b 0
f 0
nc 4
nop 1
dl 0
loc 17
rs 9.6111
1
<?php
2
3
namespace A17\Twill\Services\Cloud;
4
5
use Exception;
6
7
class Glide
8
{
9
    function makeCloudSource($source = null)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
10
    {
11
        if (blank($source)) {
12
            throw new Exception(
13
                'Glide source was not set, please set your GLIDE_SOURCE environment variable or pass the source.'
14
            );
15
        }
16
17
        if ($source == 's3' || $source == 'aws') {
18
            return app(Aws::class)->filesystemFactory($source);
19
        }
20
21
        if ($source == 'azure') {
22
            return app(Azure::class)->filesystemFactory($source);
23
        }
24
25
        return $source;
26
    }
27
}
28