Passed
Push — main ( e005e2...1bd9df )
by N.
03:40
created

Databas::radera_omgång()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 3
dl 0
loc 8
ccs 0
cts 8
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Klass Databas.
5
 * @author Niklas Dougherty
6
 */
7
8
declare(strict_types=1);
9
10
namespace Tips\Klasser;
11
12
use PDO;
13
use Tips\Klasser\Databas\Funktioner;
14
15
/**
16
 * Klass Databas.
17
 */
18
final class Databas extends Funktioner {
19
	/**
20
	 * Radera omgång.
21
	 */
22
	public function radera_omgång(string $tabell, int $omgång, Speltyp $speltyp): void {
23
		$sats = $this->instans->prepare("DELETE FROM `{$tabell}`
24
			WHERE `omgång`=:omgang AND `speltyp`=:speltyp");
25
		$sats->bindValue(':omgang', $omgång, PDO::PARAM_INT);
26
		$sats->bindValue(':speltyp', $speltyp->value, PDO::PARAM_INT);
27
		match ($sats->execute()) {
28
			true => $this->logg->logga(self::class . ": ✅ Raderade omgång. ({$omgång})"),
1 ignored issue
show
Bug introduced by
Are you sure the usage of $this->logg->logga(self:...gång. ('.$omgång.')') targeting Tips\Klasser\Logg::logga() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
29
			default => $this->logg->logga(self::class . ": ❌ Kunde inte radera omgång. ({$omgång})")
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->logg->logga(self:...gång. ('.$omgång.')') targeting Tips\Klasser\Logg::logga() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
30
		};
31
	}
32
33
	/**
34
	 * Radera sekvens.
35
	 */
36 1
	public function radera_sekvens(string $tabell, int $omgång, Speltyp $speltyp, int $sekvens): void {
37 1
		$sats = $this->instans->prepare("DELETE FROM `{$tabell}`
38 1
			WHERE `omgång`=:omgang AND `speltyp`=:speltyp AND `sekvens`=:sekvens");
39 1
		$sats->bindValue(':omgang', $omgång, PDO::PARAM_INT);
40 1
		$sats->bindValue(':speltyp', $speltyp->value, PDO::PARAM_INT);
41 1
		$sats->bindValue(':sekvens', $sekvens, PDO::PARAM_INT);
42 1
		match ($sats->execute()) {
43 1
			true => $this->logg->logga(self::class . ": ✅ Raderade sekvens. ({$omgång}-{$sekvens}–{$tabell})"),
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->logg->logga(self:...vens.'–'.$tabell.')') targeting Tips\Klasser\Logg::logga() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
44
			default => $this->logg->logga(self::class . ": ❌ Kunde inte radera sekvens. ({$omgång}-{$sekvens}–{$tabell})")
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->logg->logga(self:...vens.'–'.$tabell.')') targeting Tips\Klasser\Logg::logga() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
45 1
		};
46
	}
47
}
48