In a general setting, you wish to capture the entire environment into a macro, and then pass that macro to another macro as an argument. That is exactly what the
environ package provides:
environ allows you to capture the contents of the environment into the macro
\BODY, which is then usable for whatever means. My definition prints it using
\textit by default, but you can modify that using a different macro or font switch.
The above definition of
myenv is general enough to allow for formatting of the environment content using a macro or a switch (as is done in the 3rd example). Supplying an empty (optional) argument removes any formatting.