второй вариант я вижу так if (!is_object($this->key) { $this->key = new SubClass; } return $this->key;