User   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getUsername() 0 4 1
A getPassword() 0 4 1
1
<?php
2
require 'autoload.php';
3
4
use Redbox\Hydrate\Hydrator;
5
use function Redbox\Hydrate\Helpers\Hydrate;
6
7
class User {
8
    protected $username = '';
9
    private $password = '';
10
11
    /**
12
     * @return string
13
     */
14
    public function getUsername()
15
    {
16
        return $this->username;
17
    }
18
19
    /**
20
     * @return string
21
     */
22
    public function getPassword()
23
    {
24
        return $this->password;
25
    }
26
}
27
28
/**
29
 * Method 1
30
 */
31
$result1 = Hydrator::hydrate(new User())->with(
32
    [
33
        'username' => 'abc',
34
        'password' => 'pass'
35
    ]
36
);
37
38
/**
39
 * Method 2
40
 */
41
$result2 = Hydrate(new User())->with(
42
    [
43
        'username' => 'abc',
44
        'password' => 'pass'
45
    ]
46
);
47
48
/**
49
 * Method 3
50
 */
51
$hydrator = new Hydrator(new User());
52
$result3 = $hydrator->with(
53
    [
54
        'username' => 'abcs',
55
        'password' => 'pass'
56
    ]
57
);
58
59
unset($hydrator);
60
61
/**
62
 * Dump whatever you want
63
 */
64
//var_dump($result1);
65
//var_dump($result2);
66
//var_dump($result3);
67