public function __construct($value1, $value2) { $this->value1 = trim($value1); $this->value2 = trim($value2); if (strlen($this->value1) > 5) { $this->calculatedValue = 100; } else { $this->calculatedValue = 50; } }