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 — master ( c47409...8085bb )
by Florian
03:00
created

DocumentAdapter::getEntityClass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Stinger Entity Search package.
5
 *
6
 * (c) Oliver Kotte <[email protected]>
7
 * (c) Florian Meyer <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
namespace StingerSoft\EntitySearchBundle\Model;
13
14
class DocumentAdapter implements Document {
15
16
	/**
17
	 * Stores are fields with their values which should be stored in the index
18
	 *
19
	 * @var array
20
	 */
21
	protected $fields = array();
22
23
	/**
24
	 *
25
	 * @var string
26
	 */
27
	protected $entityClass = null;
28
29
	/**
30
	 *
31
	 * @var mixed
32
	 */
33
	protected $entityId = null;
34
35
	/**
36
	 *
37
	 * @var string
38
	 */
39
	protected $entityType = null;
40
41
	/**
42
	 *
43
	 * @var string
44
	 */
45
	protected $file = null;
46
47
	/**
48
	 *
49
	 * {@inheritdoc}
50
	 *
51
	 * @see \StingerSoft\EntitySearchBundle\Model\Document::addField()
52
	 */
53
	public function addField($fieldname, $value) {
54
		$this->fields[$fieldname] = $value;
55
	}
56
57
	/**
58
	 *
59
	 * {@inheritdoc}
60
	 *
61
	 * @see \StingerSoft\EntitySearchBundle\Model\Document::getFields()
62
	 */
63
	public function getFields() {
64
		return $this->fields;
65
	}
66
67
	/**
68
	 *
69
	 * {@inheritdoc}
70
	 *
71
	 * @see \StingerSoft\EntitySearchBundle\Model\Document::getFieldValue()
72
	 */
73
	public function getFieldValue($field) {
74
		return isset($this->fields[$field]) ? $this->fields[$field] : null;
75
	}
76
77
	/**
78
	 *
79
	 * {@inheritdoc}
80
	 *
81
	 * @see \StingerSoft\EntitySearchBundle\Model\Document::addMultiValueField()
82
	 */
83
	public function addMultiValueField($field, $value) {
84
		if(!array_key_exists($field, $this->fields)) {
85
			$this->fields[$field] = array(
86
				$value 
87
			);
88
		} else if(!in_array($value, $this->fields[$field])) {
89
			$this->fields[$field][] = $value;
90
		}
91
	}
92
93
	/**
94
	 *
95
	 * {@inheritdoc}
96
	 *
97
	 * @see \StingerSoft\EntitySearchBundle\Model\Document::setEntityClass()
98
	 */
99
	public function setEntityClass($clazz) {
100
		$this->entityClass = $clazz;
101
	}
102
103
	/**
104
	 *
105
	 * {@inheritdoc}
106
	 *
107
	 * @see \StingerSoft\EntitySearchBundle\Model\Document::getEntityClass()
108
	 */
109
	public function getEntityClass() {
110
		return $this->entityClass;
111
	}
112
113
	/**
114
	 *
115
	 * {@inheritdoc}
116
	 *
117
	 * @see \StingerSoft\EntitySearchBundle\Model\Document::setEntityId()
118
	 */
119
	public function setEntityId($id) {
120
		$this->entityId = $id;
121
	}
122
123
	/**
124
	 *
125
	 * {@inheritdoc}
126
	 *
127
	 * @see \StingerSoft\EntitySearchBundle\Model\Document::getEntityId()
128
	 */
129
	public function getEntityId() {
130
		return $this->entityId;
131
	}
132
133
	/**
134
	 *
135
	 * {@inheritdoc}
136
	 *
137
	 * @see \StingerSoft\EntitySearchBundle\Model\Document::setEntityType()
138
	 */
139
	public function setEntityType($type) {
140
		$this->entityType = $type;
141
	}
142
143
	/**
144
	 *
145
	 * {@inheritdoc}
146
	 *
147
	 * @see \StingerSoft\EntitySearchBundle\Model\Document::getEntityType()
148
	 */
149
	public function getEntityType() {
150
		return $this->entityType ? $this->entityType : $this->getEntityClass();
151
	}
152
153
	/**
154
	 *
155
	 * {@inheritdoc}
156
	 *
157
	 * @see \StingerSoft\EntitySearchBundle\Model\Document::setFile()
158
	 */
159
	public function setFile($path) {
160
		$this->file = $path;
161
	}
162
163
	/**
164
	 *
165
	 * {@inheritdoc}
166
	 *
167
	 * @see \StingerSoft\EntitySearchBundle\Model\Document::__get()
168
	 */
169
	public function __get($name) {
170
		return $this->getFieldValue($name);
171
	}
172
173
	/**
174
	 *
175
	 * {@inheritdoc}
176
	 *
177
	 * @see \StingerSoft\EntitySearchBundle\Model\Document::__isset()
178
	 */
179
	public function __isset($name) {
180
		return $this->getFieldValue($name) !== null;
181
	}
182
}