Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. <?php
  2.  
  3. require_once __DIR__ . '/vendor/autoload.php';
  4.  
  5. use YourNamespace\Enums\Compass;
  6.  
  7. $north = Compass::North();
  8. $south = Compass::South();
  9. $east = Compass::East();
  10. $west = Compass::West();
  11.  
  12. $values = Compass::values(); // [$north, $south, $east, $west]
  13. $n = Compass::valueOf('North');
  14.  
  15. $north->equals(Compass::North()); // true
  16. $north->equals($n); // true
  17. $north->equals($south); // false
  18. $north->equals('North'); // false
  19.  
  20. $north->toString(); // 'North'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement