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.
Completed
Push — dev ( 4095d1...89bae3 )
by Андрей
04:02
created

ObjectInfo::updateHash()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
/**
3
 * @link  https://github.com/old-town/workflow-zf2-toolkit
4
 * @author  Malofeykin Andrey  <[email protected]>
5
 */
6
namespace OldTown\Workflow\ZF2\Toolkit\Entity\DoctrineWorkflowStory;
7
8
use Doctrine\Common\Collections\ArrayCollection;
9
use Doctrine\ORM\Mapping as ORM;
10
11
/**
12
 * Class Object
13
 *
14
 * @ORM\Entity()
15
 * @ORM\Table(
16
 *     name="wf_object_info",
17
 *     indexes={
18
 *         @ORM\Index(name="hash", columns={"hash"})
19
 *     }
20
 * )
21
 *
22
 * @package OldTown\Workflow\ZF2\Toolkit\Entity\DoctrineWorkflowStory
23
 */
24
class ObjectInfo
25
{
26
    /**
27
     * Уникальный id данных о объекте
28
     *
29
     * @ORM\Id()
30
     * @ORM\Column(name="id", type="integer")
31
     * @ORM\GeneratedValue(strategy="IDENTITY")
32
     *
33
     * @var string
34
     */
35
    protected $id;
36
37
    /**
38
     * Имя класса объекта
39
     *
40
     * @ORM\Column(name="class_name", type="string", length=180)
41
     *
42
     *
43
     * @var string
44
     */
45
    protected $className;
46
47
    /**
48
     * id объекта
49
     *
50
     * @ORM\Column(name="object_id", type="string", length=50)
51
     *
52
     *
53
     * @var string
54
     */
55
    protected $objectId;
56
57
    /**
58
     * Псевдоним по которому можно обратиться к объекту
59
     *
60
     * @ORM\Column(name="alias", type="string", length=50)
61
     *
62
     *
63
     * @var string
64
     */
65
    protected $alias;
66
67
    /**
68
     * Все процессы workflow которые связанны с данным процесом
69
     *
70
     * @ORM\ManyToMany(targetEntity="ExtEntry", mappedBy="objectsInfo")
71
     *
72
     * @var ExtEntry[]|ArrayCollection
73
     */
74
    protected $entries;
75
76
    /**
77
     * Ключ для поиска
78
     *
79
     * @ORM\Column(name="hash", type="string", length=255)
80
     *
81
     * @var string
82
     */
83
    protected $hash;
84
85
    /**
86
     * ObjectInfo constructor.
87
     */
88
    public function __construct()
89
    {
90
        $this->entries = new ArrayCollection();
91
    }
92
93
    /**
94
     * Уникальный id данных о объект
95
     *
96
     * @return string
97
     */
98
    public function getId()
99
    {
100
        return $this->id;
101
    }
102
103
    /**
104
     * Возвращает уникальный id данных о объект
105
     *
106
     * @param string $id
107
     *
108
     * @return $this
109
     */
110
    public function setId($id)
111
    {
112
        $this->id = $id;
113
114
        return $this;
115
    }
116
117
    /**
118
     * Имя класса объекта
119
     *
120
     * @return string
121
     */
122
    public function getClassName()
123
    {
124
        return $this->className;
125
    }
126
127
    /**
128
     * Устанавливает имя класса объекта
129
     *
130
     * @param string $className
131
     *
132
     * @return $this
133
     */
134
    public function setClassName($className)
135
    {
136
        $this->className = $className;
137
        $this->updateHash();
138
139
        return $this;
140
    }
141
142
    /**
143
     * id объекта
144
     *
145
     * @return string
146
     */
147
    public function getObjectId()
148
    {
149
        return $this->objectId;
150
    }
151
152
    /**
153
     * Устанвливает id объекта
154
     *
155
     * @param string $objectId
156
     *
157
     * @return $this
158
     */
159
    public function setObjectId($objectId)
160
    {
161
        $this->objectId = $objectId;
162
        $this->updateHash();
163
164
        return $this;
165
    }
166
167
    /**
168
     * Псевдоним по которому можно обратиться к объекту
169
     *
170
     * @return string
171
     */
172
    public function getAlias()
173
    {
174
        return $this->alias;
175
    }
176
177
    /**
178
     * Устанавливает пседвоним по которому можно обратиться к объекту
179
     *
180
     * @param string $alias
181
     *
182
     * @return $this
183
     */
184
    public function setAlias($alias)
185
    {
186
        $this->alias = $alias;
187
188
        return $this;
189
    }
190
191
    /**
192
     * Возвращает все процессы wf,в которых участвует объект
193
     *
194
     * @return ArrayCollection|ExtEntry[]
195
     */
196
    public function getEntries()
197
    {
198
        return $this->entries;
199
    }
200
201
    /**
202
     * Добавляет процесс wf, в котором задействован объект
203
     *
204
     * @param ExtEntry $entry
205
     *
206
     * @return $this
207
     */
208
    public function addEntry(ExtEntry $entry)
209
    {
210
        if (!$this->getEntries()->contains($entry)) {
211
            $this->getEntries()->add($entry);
212
        }
213
214
        return $this;
215
    }
216
217
    /**
218
     * генерация хеша
219
     *
220
     * @return void
221
     */
222
    protected function updateHash()
223
    {
224
        $hash = $this->getClassName() . '_' . $this->getObjectId();
225
        $base64Hash = base64_encode($hash);
226
227
        $this->hash = $base64Hash;
228
    }
229
}
230