GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Base::__destruct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * DataMapper
4
 *
5
 * @copyright Copyright (c)  Gjero Krsteski (http://krsteski.de)
6
 * @license   http://opensource.org/licenses/MIT MIT License
7
 */
8
9
namespace Pimf\DataMapper;
10
11
use Pimf\Util\IdentityMap;
12
13
/**
14
 * For mapping the domain models to the persistence layer.
15
 *
16
 * Defines the general behaviour for the data-mappers - you have to extend it.
17
 *
18
 * You have to use it if you want to persist data.
19
 *
20
 * @package DataMapper
21
 * @author  Gjero Krsteski <[email protected]>
22
 *
23
 * @method insert($entity)
24
 * @method update($entity)
25
 * @method delete($entity)
26
 * @method find($key)
27
 */
28
abstract class Base
29
{
30
    /**
31
     * @var \PDO The database resource.
32
     */
33
    protected $pdo;
34
35
    /**
36
     * @var \Pimf\Util\IdentityMap
37
     */
38
    protected $identityMap;
39
40
    /**
41
     * @param \PDO $pdo
42
     */
43
    public function __construct(\PDO $pdo)
44
    {
45
        $this->pdo = $pdo;
46
        $this->identityMap = new IdentityMap();
47
    }
48
49
    public function __destruct()
50
    {
51
        unset($this->identityMap, $this->pdo);
52
    }
53
54
    /**
55
     * Makes a given model-property accessible.
56
     *
57
     * @param object $model
58
     * @param int    $value
59
     * @param string $property
60
     *
61
     * @return mixed
62
     */
63
    public function reflect($model, $value, $property = 'id')
64
    {
65
        $attribute = new \ReflectionProperty($model, $property);
66
        $attribute->setAccessible(true);
67
        $attribute->setValue($model, $value);
68
69
        return $model;
70
    }
71
}
72