Completed
Push — master ( 356279...28992d )
by Dmitry
02:58
created

Storage::url()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Basis\Test;
4
5
use Basis\Storage as BaseStorage;
6
7
class Storage extends BaseStorage
8
{
9 1
    public function download(string $hash)
10
    {
11 1
        return $this->data[$hash];
0 ignored issues
show
Bug introduced by
The property data does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
12
    }
13
14 1
    public function upload(string $filename, $contents) : string
15
    {
16 1
        $hash = md5($contents);
17 1
        $this->data[$hash] = $contents;
18 1
        return $hash;
19
    }
20
21 1
    public function url(string $hash) : string
22
    {
23 1
        return "/tmp/$hash";
24
    }
25
}