Skip to content

Commit b496e4d

Browse files
committed
throw exception when zamekK is not loaded already
1 parent 2925d55 commit b496e4d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/AbraFlexi/lock.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,20 @@ trait lock
2323
{
2424
public function locked(): bool
2525
{
26-
return $this->getDataValue('zamekK') === 'zamek.otevreno';
26+
$lockValue = $this->getDataValue('zamekK');
27+
if(is_null($lockValue)){
28+
throw new \InvalidArgumentException('unset zamekK',1);
29+
}
30+
return $lockValue === 'zamek.otevreno';
2731
}
2832

2933
public function getLockType(): string
3034
{
31-
return str_replace('zamek.', '', (string) $this->getDataValue('zamekK'));
35+
$lockValue = $this->getDataValue('zamekK');
36+
if(is_null($lockValue)){
37+
throw new \InvalidArgumentException('unset zamekK',1);
38+
}
39+
return str_replace('zamek.', '', $lockValue);
3240
}
3341

3442
public function lock(): bool

0 commit comments

Comments
 (0)