Issues (100)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/Entities/Patient.php (7 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/**
4
 * Patient
5
 *
6
 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
7
 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
8
 *
9
 * Permission is hereby granted to use or copy this program
10
 * for any purpose, provided the above notices are retained on all copies.
11
 * Permission to modify the code and to distribute modified code is granted,
12
 * provided the above notices are retained, and a notice that the code was
13
 * modified is included with the above copyright notice.
14
 *
15
 * @category  Wp
16
 * @package   Punction
17
 * @author    Andrzej Marcinkowski <[email protected]>
18
 * @copyright 2014 Wojewódzki Szpital Zespolony, Kalisz
19
 * @license   MIT http://opensource.org/licenses/MIT
20
 * @version   1.0  $Format:%H$
21
 * @link      http://
22
 * @since     File available since Release 1.0.0
23
 * PHP Version 5
24
 */
25
namespace Hospitalplugin\Entities;
26
27
/**
28
 * Patient
29
 *
30
 * @category Wp
31
 * @package Punction
32
 * @author Andrzej Marcinkowski <[email protected]>
33
 * @copyright 2014 Wojewódzki Szpital Zespolony, Kalisz
34
 * @license MIT http://opensource.org/licenses/MIT
35
 * @version 1.0 $Format:%H$
36
 * @link http://
37
 * @since File available since Release 1.0.0
38
 *       
39
 *        @Entity
40
 *        @Table(name="Patient",
41
 *        options={"collate"="utf8_unicode_ci", "charset"="utf8", "engine"="InnoDB"},
42
 *        indexes={
43
 *        @index(name="name_idx", columns={"name"}),
44
 *        @index(name="dataKategoryzacji_idx", columns={"dataKategoryzacji"}),
45
 *        @index(name="oddzialId_idx", columns={"oddzialId"}),
46
 *        @index(name="kategoriaPacjenta_idx", columns={"kategoriaPacjenta"})})
47
 *        @InheritanceType("JOINED")
48
 *        @DiscriminatorColumn(name="discr", type="string")
49
 *        @DiscriminatorMap({"patient" = "Patient",
50
 *        "patientzz" = "PatientZZ",
51
 *        "patientped" = "PatientPED",
52
 *        "patientpsy" = "PatientPSY",
53
 *        "patientdia" = "PatientDIA",
54
 *        "patientpor" = "PatientPOR",
55
 *        "patientpol" = "PatientPOL"
56
 *        })
57
 */
58
class Patient {
59
	
60
	/**
61
	 *
62
	 * @var string $typ typ pacjenta
63
	 */
64
	protected $typ = "";
65
	
66
	/**
67
	 * id
68
	 * @Id @Column(type="integer") @GeneratedValue
69
	 */
70
	public $id;
71
	
72
	/**
73
	 * name
74
	 * @Column(type="string", length=50)
75
	 */
76
	public $name;
77
	
78
	/**
79
	 * @Column(type="string", length=11)
80
	 */
81
	public $pesel;
82
	
83
	/**
84
	 * @Column(type="integer") *
85
	 */
86
	public $numerHistorii;
87
	
88
	/**
89
	 * $dataKategoryzacji datetime
90
	 * @Column(type="datetime") *
91
	 */
92
	public $dataKategoryzacji;
93
	
94
	/**
95
	 * @Column(type="integer") *
96
	 */
97
	protected $oddzialId;
98
	
99
	/**
100
	 * @Column(columnDefinition="TINYINT(4) NOT NULL DEFAULT 0")
101
	 */
102
	public $kategoriaPacjenta = 0;
103
	
104
	/**
105
	 * @ManyToOne(targetEntity="Hospitalplugin\Entities\User")
106
	 * @JoinColumn(name="userId", referencedColumnName="id", nullable=true)
107
	 * @Column(columnDefinition="INT(11) NOT NULL DEFAULT 0")
108
	 */
109
	public $user;
110
	
111
	/**
112
	 * Constructor
113
	 *
114
	 * @param unknown $args        	
115
	 */
116
	function __construct($args) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
117
		if (! isset ( $args ) || empty ( $args )) {
118
			return;
119
		}
120 View Code Duplication
		foreach ( $args as $key => $value ) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
121
			if ($key == 'dataKategoryzacji') {
122
				$value = new \DateTime ( $value . ' 12:00:00' );
123
			}
124
			call_user_func ( array (
125
					$this,
126
					'set' . $key 
127
			), $value );
128
		}
129
	}
130
	
131
	/**
132
	 * getId
133
	 *
134
	 * @return id
135
	 */
136
	public function getId() {
137
		return $this->id;
138
	}
139
	
140
	/**
141
	 * sets id
142
	 *
143
	 * @param int $id
144
	 *        	ID
145
	 *        	
146
	 * @return \Hospitalplugin\Entities\Patient
147
	 */
148
	public function setId($id) {
149
		$this->id = $id;
150
		return $this;
151
	}
152
	
153
	/**
154
	 * getName
155
	 *
156
	 * @return name
157
	 */
158
	public function getName() {
159
		return $this->name;
160
	}
161
	
162
	/**
163
	 * setName
164
	 *
165
	 * @param string $name
166
	 *        	string name
167
	 *        	
168
	 * @return Patient
169
	 */
170
	public function setName($name) {
171
		$this->name = $name;
172
		return $this;
173
	}
174
	
175
	/**
176
	 * getDataKategoryzacji
177
	 *
178
	 * @return \DateTime dataKategoryzacji
179
	 */
180
	public function getDataKategoryzacji() {
181
		return $this->dataKategoryzacji;
182
	}
183
	
184
	/**
185
	 * setDataKategoryzacji
186
	 *
187
	 * @param \DateTime $dataKategoryzacji
188
	 *        	data kategoryzyzacji
189
	 *        	
190
	 * @return Patient
191
	 */
192
	public function setDataKategoryzacji(\DateTime $dataKategoryzacji) {
193
		$this->dataKategoryzacji = $dataKategoryzacji;
194
		return $this;
195
	}
196
	
197
	/**
198
	 * getOddzialId
199
	 *
200
	 * @return oddzialId
201
	 */
202
	public function getOddzialId() {
203
		return $this->oddzialId;
204
	}
205
	
206
	/**
207
	 * setOddzialId
208
	 *
209
	 * @param int $oddzialId
210
	 *        	oddzial id
211
	 *        	
212
	 * @return Patient
213
	 */
214
	public function setOddzialId($oddzialId) {
215
		$this->oddzialId = $oddzialId;
216
		return $this;
217
	}
218
	
219
	/**
220
	 *
221
	 * @param Ward $ward        	
222
	 */
223
	public function setWard($ward) {
224
		$this->oddzialId = $ward->id;
225
		return $this;
226
	}
227
	
228
	/**
229
	 * getOddzialId
230
	 *
231
	 * @return oddzialId
232
	 */
233
	public function getNumerHistorii() {
234
		return $this->numerHistorii;
235
	}
236
	
237
	/**
238
	 * setOddzialId
239
	 *
240
	 * @param int $oddzialId
0 ignored issues
show
There is no parameter named $oddzialId. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
241
	 *        	oddzial id
242
	 *        	
243
	 * @return Patient
244
	 */
245
	public function setNumerHistorii($numerHistorii) {
246
		$this->numerHistorii = $numerHistorii;
247
		return $this;
248
	}
249
	
250
	/**
251
	 * getPesel
252
	 *
253
	 * @return pesel
254
	 */
255
	public function getPesel() {
256
		return $this->pesel;
257
	}
258
	
259
	/**
260
	 * setPesel
261
	 *
262
	 * @param string $pesel
263
	 *        	nr pesel
264
	 *        	
265
	 * @return Patient
266
	 */
267
	public function setPesel($pesel) {
268
		$this->pesel = $pesel;
269
		return $this;
270
	}
271
	
272
	/**
273
	 * getKategoriaPacjenta
274
	 *
275
	 * @return kategoriaPacjenta
276
	 */
277
	public function getKategoriaPacjenta() {
278
		return $this->kategoriaPacjenta;
279
	}
280
	
281
	/**
282
	 * setKategoriaPacjenta
283
	 *
284
	 * @param int $kategoriaPacjenta
285
	 *        	kategoriaPacjenta
286
	 *        	
287
	 * @return Patient
288
	 */
289
	public function setKategoriaPacjenta($kategoriaPacjenta) {
290
		$this->kategoriaPacjenta = $kategoriaPacjenta;
291
		return $this;
292
	}
293
	
294
	/**
295
	 * getTyp
296
	 *
297
	 * @return typ
298
	 */
299
	public function getTyp() {
300
		return $this->typ;
301
	}
302
	
303
	/**
304
	 * setTyp
305
	 *
306
	 * @param string $typ        	
307
	 *
308
	 * @return \Hospitalplugin\Entities\Patient
309
	 */
310
	public function setTyp($typ) {
311
		$this->typ = $typ;
312
		return $this;
313
	}
314
	
315
	/**
316
	 * getUser
317
	 */
318
	public function getUser() {
319
		return $this->user;
320
	}
321
	
322
	/**
323
	 *
324
	 * @param User $user        	
325
	 */
326
	public function setUser($user) {
327
		$this->user = $user;
328
		return $this;
329
	}
330
	
331
	/**
332
	 * toString
333
	 *
334
	 * @return string
335
	 */
336
	public function toString() {
337
		$txt = $this->getName ();
338
		$txt .= $this->getPesel ();
339
		$txt .= "id:";
340
		$txt .= $this->getId ();
341
		$txt .= "oid:";
342
		$txt .= $this->getOddzialId ();
343
		$txt .= "d:";
344
		$data = $this->getDataKategoryzacji ();
345
		if ($data instanceof \DateTime) {
346
			$txt .= $this->getDataKategoryzacji ()->format ( "Y-m-d" );
347
		} else {
348
			$txt .= $this->getDataKategoryzacji ();
349
		}
350
		return $txt;
351
	}
352
	public function __toString() {
353
		return $this->toString ();
354
	}
355
	
356
	/**
357
	 * getFields
358
	 *
359
	 * @return multitype:string
0 ignored issues
show
The doc-type multitype:string could not be parsed: Unknown type name "multitype:string" at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
360
	 */
361
	protected static function getFields() {
362
		$fields = array (
363
				"id",
364
				"name",
365
				"pesel",
366
				"numerHistorii",
367
				"dataKategoryzacji",
368
				"kategoriaPacjenta" 
369
		);
370
		return $fields;
371
	}
372
	
373
	/**
374
	 * toDatatablesJSONString
375
	 *
376
	 * @return string
377
	 */
378
	public function toDatatablesJSONString() {
379
		$return_object_array = [ ];
380
		$fields = $this->getFields ();
381 View Code Duplication
		foreach ( $fields as $field ) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
382
			$value = call_user_func ( array (
383
					$this,
384
					'get' . $field 
385
			) );
386
			if ($value instanceof \DateTime) {
387
				$value = $value->format ( 'Y-m-d' );
388
			}
389
			array_push ( $return_object_array, array (
390
					$field => $value 
391
			) );
392
		}
393
		return json_encode ( $this );
394
	}
395
	
396
	/**
397
	 * String with comma separated values.
398
	 *
399
	 * @deprecated JSON used
400
	 * @param unknown $patient        	
0 ignored issues
show
There is no parameter named $patient. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
401
	 *
402
	 * @return string
403
	 */
404
	public function toDatatablesString() {
405
		$string = "";
406
		$fields = $this::getFields ();
407 View Code Duplication
		foreach ( $fields as $field ) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
408
			$value = call_user_func ( array (
409
					$this,
410
					'get' . $field 
411
			) );
412
			if ($value instanceof \DateTime) {
413
				$value = $value->format ( 'Y-m-d' );
414
			}
415
			$string .= $value . ",";
416
		}
417
		$string = trim ( $string, "," );
418
		$string = str_replace ( "\n", "", $string );
419
		return $string;
420
	}
421
}
422