NetworkConfig.php 951 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace Docker\Composer;
  3. class NetworkConfig
  4. {
  5. protected $config = [];
  6. /**
  7. * @param string $driver Driver type. By default use 'default'
  8. * @return NetworkConfig Return this object.
  9. */
  10. public function addDriver($driver = 'default')
  11. {
  12. $this->config['driver'] = $driver;
  13. return $this;
  14. }
  15. /**
  16. * @param string $driver Subnet. By default 172.172.172.0/24
  17. * @return NetworkConfig Return this object.
  18. */
  19. public function addSubnetGateway($subnet = '172.172.172.0/24')
  20. {
  21. if (!isset($this->config['config'])) {
  22. $this->config['config'] = [];
  23. }
  24. $this->config['config'][] = array('subnet' => $subnet);
  25. // $this->config['config'][] = array('gateway' => $gateway);
  26. return $this;
  27. }
  28. /**
  29. * @return array Return array with config.
  30. */
  31. public function getConfig()
  32. {
  33. return $this->config;
  34. }
  35. }