Completed
Push — master ( 53c3c6...647838 )
by Xinjiang
03:18
created

FakeConnection::reverseLookup()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace Soleo\UrlShortener;
4
5
class FakeConnection implements ConnectionInterface
6
{
7
    private $fakeDB;
8
    public function __construct($config = null)
0 ignored issues
show
Unused Code introduced by
The parameter $config is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
9
    {
10
        $this->fakeDB = [
11
            'A9A' => 'https://example.com'
12
        ];
13
    }
14
15
    public function lookup($slug, $update)
16
    {
17
        return $this->fakeDB[$slug];
18
    }
19
20
    public function reverseLookup($longUrl)
21
    {
22
        $reversedArray = array_flip($this->fakeDB);
23
        return $reversedArray[$longUrl];
24
    }
25
26
    public function addNewRecord($longUrl, $slug)
27
    {
28
        return true;
29
    }
30
31
    public function getIncrementUid()
32
    {
33
        return 1;
34
    }
35
}
36