/** * @param string $property * @param string $value * @param Environment $environment * * @return int */ protected function setProperty($property, $value, Environment $environment) { if (!$this->validateValue($property, $value)) { return 1; } $type = $this->getType($property); if ($type === 'boolean' && $value === 'false') { $value = false; } settype($value, $type); $currentValue = $environment->getProperty($property, false); if ($currentValue === $value) { $this->stdErr->writeln("Property <info>{$property}</info> already set as: " . $environment->getProperty($property, false)); return 0; } $environment->update(array($property => $value)); $this->stdErr->writeln("Property <info>{$property}</info> set to: " . $environment[$property]); if ($property === 'enable_smtp' && !$environment->getLastActivity()) { $this->rebuildWarning(); } return 0; }
/** * @param string $property * @param string $value * @param Environment $environment * * @return int */ protected function setProperty($property, $value, Environment $environment) { if (!$this->validateValue($property, $value)) { return 1; } $type = $this->getType($property); if ($type === 'boolean' && $value === 'false') { $value = false; } settype($value, $type); $currentValue = $environment->getProperty($property, false); if ($currentValue === $value) { $this->stdErr->writeln("Property <info>{$property}</info> already set as: " . $this->formatter->format($environment->getProperty($property, false), $property)); return 0; } $environment->update(array($property => $value)); $this->stdErr->writeln("Property <info>{$property}</info> set to: " . $this->formatter->format($environment[$property], $property)); $rebuildProperties = array('enable_smtp', 'restrict_robots'); if (in_array($property, $rebuildProperties) && !$environment->getLastActivity()) { $this->rebuildWarning(); } // Refresh the stored environments. $this->getEnvironments($this->getSelectedProject(), true); return 0; }