* @license https://www.gnu.org/licenses/gpl-3.0.en.html GNU General Public License V3 * @package SWDB */ /** * Action superclass. * * Every action must inherit from this one. * * @category Action */ abstract class Action{ /** * @var int HTTP status code returned by the action. 0 before executing. */ protected $code = 0; /** * @var string HTTP status message. Empty before executing. */ protected $message = ""; /** * @var string Output returned by the action. Empty before excuting. */ protected $output = ""; /** * Executes the action. * * To be implemented in the individual actions. */ abstract public function execute(); /** * Retrieves the HTTP status code returned by the action. * * If the action has not been executed yet, the code will be 0. * * @return int HTTP status code. */ public function get_code(){ return $this->code; } /** * Retrieves the HTTP status message returned by the action. * * If the action has not been executed yet, the message will be empty. * * @return string HTTP status message. */ public function get_message(){ return $this->message; } /** * Retrieves the output buffered by the action. * * If the action has not been executed yet or it didn't buffer anything, it will be empty. * * @return string Action output. */ public function get_output(){ return $this->output; } }