Skip to content

Commit a313d3d

Browse files
committed
rename isPresent to hasValue in cmd optional
1 parent b0612b9 commit a313d3d

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

examples/plugins/php/src/HelloPlugin.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use Dragonfly\PluginLib\Events\EventContext;
2323
use Dragonfly\PluginLib\Events\Listener;
2424
use ExamplePhp\EffectCommand;
25+
use ExamplePhp\CircleCommand;
2526

2627
class HelloPlugin extends PluginBase implements Listener {
2728

@@ -30,6 +31,7 @@ class HelloPlugin extends PluginBase implements Listener {
3031

3132
public function onEnable(): void {
3233
$this->registerCommandClass(new EffectCommand());
34+
$this->registerCommandClass(new CircleCommand());
3335
$this->registerCommand('/cheers', 'Send a toast from PHP');
3436
$this->registerCommand('/pokemon', 'Give a Pokemon item');
3537
// Register custom items

packages/php/src/Commands/Optional.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@
88
*/
99
class Optional {
1010
private mixed $value = null;
11-
private bool $present = false;
11+
private bool $hasValue = false;
1212

1313
public function set(mixed $value): void {
1414
$this->value = $value;
15-
$this->present = true;
15+
$this->hasValue = true;
1616
}
1717

18-
public function isPresent(): bool {
19-
return $this->present;
18+
public function hasValue(): bool {
19+
return $this->hasValue;
2020
}
2121

2222
public function get(): mixed {
2323
return $this->value;
2424
}
2525

2626
public function getOr(mixed $default): mixed {
27-
return $this->present ? $this->value : $default;
27+
return $this->hasValue ? $this->value : $default;
2828
}
2929
}

0 commit comments

Comments
 (0)