| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- /**
- * Action superclass file.
- *
- * Provides a class to be extended for individual actions.
- *
- * @author Iñigo Valentin <i@inigovalentin.com>
- * @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;
- }
- }
|