Stopping a Workflow Transition

I am moving an item from state Quick Edit to state Public, using a workflow transition. I am trying to create an extension that will do some checks on the transition to see if it should be completed or not based on some functionality. Based on if the checks pass or not, I would either want to A. continue on with the transition as planned, or B. stop the transition so that the item stays in the Quick Edit state instead of completing the transition and going into Public state.