Family.php 627 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace WhichBrowser\Model;
  3. use WhichBrowser\Model\Primitive\NameVersion;
  4. class Family extends NameVersion
  5. {
  6. /**
  7. * Get an array of all defined properties
  8. *
  9. * @internal
  10. *
  11. * @return array
  12. */
  13. public function toArray()
  14. {
  15. $result = [];
  16. if (!empty($this->name) && empty($this->version)) {
  17. return $this->name;
  18. }
  19. if (!empty($this->name)) {
  20. $result['name'] = $this->name;
  21. }
  22. if (!empty($this->version)) {
  23. $result['version'] = $this->version->toArray();
  24. }
  25. return $result;
  26. }
  27. }