I am working on some legacy code which has Controller
class which extends Laravels native Controller
. Inside that class I have constant statuses:
class Controller extends \Controller
{
const STATUS_SUCCESS = 'success';
const STATUS_ERROR = 'error';
....
Fist thing that bothers me is the fact that there are statuses inside a controller class, and I don't think they should be there by good design, but rather on some other ControllerStatus
class.
Another thing about it is that those statuses are repeated in several unrelated classes, so I am wondering if it is a good practice to make a generic class Status
which will hold possible statuses?
The possible issue I see here is that every class that needs to return a status now in return instead of being coupled only to say Controller
, needs to be coupled with Status
as well.
How would I best approach this?