File   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
A getSeekableS3Stream() 0 6 1
1
<?php
2
namespace STS\StorageConnect\Drivers\Dropbox;
3
4
use Illuminate\Support\Str;
5
use Kunnu\Dropbox\DropboxFile;
6
7
class File extends DropboxFile
8
{
9
    /**
10
     * File constructor.
11
     *
12
     * @param string $filePath
13
     * @param string $mode
14
     */
15
    public function __construct($filePath, $mode = self::MODE_READ)
16
    {
17
        parent::__construct($filePath, $mode = self::MODE_READ);
18
19
        if(Str::startsWith($filePath, "s3://")) {
20
            $this->setStream($this->getSeekableS3Stream());
21
        }
22
    }
23
24
    /**
25
     * @return \GuzzleHttp\Psr7\Stream
26
     */
27
    protected function getSeekableS3Stream()
28
    {
29
        return \GuzzleHttp\Psr7\stream_for(fopen($this->path, $this->mode, false, stream_context_create([
0 ignored issues
show
Deprecated Code introduced by
The function GuzzleHttp\Psr7\stream_for() has been deprecated with message: stream_for will be removed in guzzlehttp/psr7:2.0. Use Utils::streamFor instead.

This function has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead.

Loading history...
30
            's3' => ['seekable' => true]
31
        ])));
32
    }
33
}