getCode(); $scope = TypeConverter::toLegacy($javascript->getScope()); } $this->code = $code; $this->scope = $scope; } /** * Returns this code as a string * @return string */ public function __toString() { return $this->code; } /** * Converts this MongoCode to the new BSON JavaScript type * * @return \MongoDB\BSON\Javascript * @internal This method is not part of the ext-mongo API */ public function toBSONType() { return new \MongoDB\BSON\Javascript($this->code, !empty($this->scope) ? $this->scope : null); } }