File tree Expand file tree Collapse file tree
packages/php/src/Commands Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222use Dragonfly \PluginLib \Events \EventContext ;
2323use Dragonfly \PluginLib \Events \Listener ;
2424use ExamplePhp \EffectCommand ;
25+ use ExamplePhp \CircleCommand ;
2526
2627class 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
Original file line number Diff line number Diff line change 88 */
99class 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}
You can’t perform that action at this time.
0 commit comments