Using the console application classes in web application.

Hello,

I have a console application that works well. I would avoid re-writing the code for the web application but I need to perform the same operations. I have written something like

$ cmd = new myClassCommand ($ command, $ cmdRunner);

where

cmdRunner CConsoleCommandRunner $ = new ();

but of course it is empty.

I might populate it with the same values ​​that I get in console application but it is the right way?

I agree to rewrite the same code twice??