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.

BelegungsplanObjekteModel::findPublishedByPids()   A
last analyzed

Complexity

Conditions 6
Paths 5

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 6
eloc 9
nc 5
nop 2
dl 0
loc 13
rs 9.2222
c 0
b 0
f 0
1
<?php
2
/**
3
* Contao Open Source CMS
4
*
5
* Copyright (c) Jan Karai
6
*
7
* @license LGPL-3.0+
8
*/
9
namespace Mailwurm\Belegung;
10
/**
11
* Lesen und Schreiben Belegungsplan Objekte
12
*
13
* @property integer $id
14
* @property integer $pid
15
* @property integer $sorting
16
* @property integer $tstamp
17
* @property string  $name
18
* @property string  $infotext
19
* @property integer $author
20
* @property boolean $published
21
*
22
* @method static BelegungsplanObjekteModel|null findById($id, $opt=array())
23
* @method static BelegungsplanObjekteModel|null findByPk($id, array $opt=array())
24
* @method static BelegungsplanObjekteModel|null findByIdOrName($val, array $opt=array())
25
* @method static BelegungsplanObjekteModel|null findOneBy($col, $val, array $opt=array())
26
* @method static BelegungsplanObjekteModel|null findOneByPid($val, $opt=array())
27
* @method static BelegungsplanObjekteModel|null findOneBySorting($val, $opt=array())
28
* @method static BelegungsplanObjekteModel|null findOneByTstamp($val, $opt=array())
29
* @method static BelegungsplanObjekteModel|null findOneByName($val, $opt=array())
30
* @method static BelegungsplanObjekteModel|null findOneByInfotext($val, $opt=array())
31
* @method static BelegungsplanObjekteModel|null findOneByAuthor($val, $opt=array())
32
* @method static BelegungsplanObjekteModel|null findOneByPublished($val, $opt=array())
33
*
34
* @method static Model\Collection|BelegungsplanObjekteModel[]|BelegungsplanObjekteModel|null findByPid($val, $opt=array())
35
* @method static Model\Collection|BelegungsplanObjekteModel[]|BelegungsplanObjekteModel|null findBySorting($val, $opt=array())
36
* @method static Model\Collection|BelegungsplanObjekteModel[]|BelegungsplanObjekteModel|null findByTstamp($val, $opt=array())
37
* @method static Model\Collection|BelegungsplanObjekteModel[]|BelegungsplanObjekteModel|null findByName($val, $opt=array())
38
* @method static Model\Collection|BelegungsplanObjekteModel[]|BelegungsplanObjekteModel|null findByInfotext($val, $opt=array())
39
* @method static Model\Collection|BelegungsplanObjekteModel[]|BelegungsplanObjekteModel|null findByAuthor($val, $opt=array())
40
* @method static Model\Collection|BelegungsplanObjekteModel[]|BelegungsplanObjekteModel|null findByPublished($val, $opt=array())
41
* @method static Model\Collection|BelegungsplanObjekteModel[]|BelegungsplanObjekteModel|null findMultipleByIds($val, array $opt=array())
42
* @method static Model\Collection|BelegungsplanObjekteModel[]|BelegungsplanObjekteModel|null findBy($col, $val, array $opt=array())
43
* @method static Model\Collection|BelegungsplanObjekteModel[]|BelegungsplanObjekteModel|null findAll(array $opt=array())
44
*
45
* @method static integer countById($id, $opt=array())
46
* @method static integer countByPid($val, $opt=array())
47
* @method static integer countBySorting($val, $opt=array())
48
* @method static integer countByTstamp($val, $opt=array())
49
* @method static integer countByName($val, $opt=array())
50
* @method static integer countByInfotext($val, $opt=array())
51
* @method static integer countByAuthor($val, $opt=array())
52
* @method static integer countByPublished($val, $opt=array())
53
*
54
* @author Jan Karai <http://www.sachsen-it.de>
55
*/
56
class BelegungsplanObjekteModel extends \Model {
57
	/**
58
	 * Table name
59
	 * @var string
60
	 */
61
	protected static $strTable = 'tl_belegungsplan_objekte';
62
	/**
63
	 * Find a published Belegungsplanobjekt from one or more categories by its ID or name
64
	 *
65
	 * @param mixed $varId      The numeric ID or name
66
	 * @param array $arrPids    An array of parent IDs
67
	 * @param array $arrOptions An optional options array
68
	 *
69
	 * @return BelegungsplanObjekteModel|null The model or null if there is no Belegungsplanobjekt
70
	 */
71
	public static function findPublishedByParentAndIdOrName($varId, $arrPids, array $arrOptions=array()) {
72
		if(!is_array($arrPids) || empty($arrPids)) {
0 ignored issues
show
introduced by
The condition is_array($arrPids) is always true.
Loading history...
73
			return null;
74
		}
75
		$t = static::$strTable;
76
		$arrColumns = !is_numeric($varId) ? array("$t.name=?") : array("$t.id=?");
77
		$arrColumns[] = "$t.pid IN(" . implode(',', array_map('intval', $arrPids)) . ")";
78
		if(isset($arrOptions['ignoreFePreview']) || !BE_USER_LOGGED_IN) {
79
			$arrColumns[] = "$t.published='1'";
80
		}
81
		return static::findOneBy($arrColumns, $varId, $arrOptions);
82
	}
83
	/**
84
	 * Find all published Belegungsplanobjekte by their parent ID
85
	 *
86
	 * @param int   $intPid     The parent ID
87
	 * @param array $arrOptions An optional options array
88
	 *
89
	 * @return Model\Collection|BelegungsplanObjekteModel[]|BelegungsplanObjekteModel|null A collection of models or null if there are no Belegungsplanobjekte
0 ignored issues
show
Bug introduced by
The type Mailwurm\Belegung\Model\Collection was not found. Did you mean Model\Collection? If so, make sure to prefix the type with \.
Loading history...
90
	 */
91
	public static function findPublishedByPid($intPid, array $arrOptions=array()) {
92
		$t = static::$strTable;
93
		$arrColumns = array("$t.pid=?");
94
		if(isset($arrOptions['ignoreFePreview']) || !BE_USER_LOGGED_IN) {
95
			$arrColumns[] = "$t.published='1'";
96
		}
97
		if(!isset($arrOptions['order'])) {
98
			$arrOptions['order'] = "$t.sorting";
99
		}
100
		return static::findBy($arrColumns, $intPid, $arrOptions);
101
	}
102
	/**
103
	 * Find all published Belegungsplanobjekte by their parent IDs
104
	 *
105
	 * @param array $arrPids    An array of Belegungsplan category IDs
106
	 * @param array $arrOptions An optional options array
107
	 *
108
	 * @return Model\Collection|BelegungsplanObjekteModel[]|BelegungsplanObjekteModel|null A collection of models or null if there are no Belegungsplanobjekte
109
	 */
110
	public static function findPublishedByPids($arrPids, array $arrOptions=array()) {
111
		if(!is_array($arrPids) || empty($arrPids)) {
0 ignored issues
show
introduced by
The condition is_array($arrPids) is always true.
Loading history...
112
			return null;
113
		}
114
		$t = static::$strTable;
115
		$arrColumns = array("$t.pid IN(" . implode(',', array_map('intval', $arrPids)) . ")");
116
		if (isset($arrOptions['ignoreFePreview']) || !BE_USER_LOGGED_IN) {
117
			$arrColumns[] = "$t.published='1'";
118
		}
119
		if (!isset($arrOptions['order'])) {
120
			$arrOptions['order'] = "$t.pid, $t.sorting";
121
		}
122
		return static::findBy($arrColumns, null, $arrOptions);
123
	}
124
}
125