InstanceQuery::hasInstance()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
ccs 0
cts 3
cp 0
crap 2
1
<?php
2
3
namespace Jalle19\StatusManager\Database;
4
5
use Jalle19\StatusManager\Configuration\Instance as ConfiguredInstance;
6
use Jalle19\StatusManager\Database\Base\InstanceQuery as BaseInstanceQuery;
7
8
/**
9
 * @package   Jalle19\StatusManager\Database
10
 * @copyright Copyright &copy; Sam Stenvall 2015-
11
 * @license   https://www.gnu.org/licenses/gpl.html The GNU General Public License v2.0
12
 */
13
class InstanceQuery extends BaseInstanceQuery
14
{
15
16
	/**
17
	 * @param ConfiguredInstance $instance
18
	 *
19
	 * @return bool whether the instance exists in the database
20
	 */
21
	public function hasInstance(ConfiguredInstance $instance)
22
	{
23
		return $this->findPk($instance->getName()) !== null;
24
	}
25
26
}
27