Guest User

Untitled

a guest
Jun 21st, 2016
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.03 KB | None | 0 0
  1. <?php
  2. /*
  3. * CONTROLLER
  4. */
  5.   class Controller
  6.   {
  7.     //OBJECTS
  8.     private $model;
  9.     private $view;
  10.    
  11.     //DATA
  12.     private $string;
  13.     private $length;
  14.  
  15.     function __construct()
  16.     {
  17.       $this->startModel();
  18.       $this->getString();
  19.       $this->getLength();
  20.       $this->echoLength();
  21.     }
  22.  
  23.     function startModel()
  24.     {
  25.       require_once '/../model/model.php';
  26.       $this->model = new Model();
  27.     }
  28.  
  29.     function getString()
  30.     {
  31.       $this->string = $_POST['string'];
  32.     }
  33.  
  34.     function getLength()
  35.     {
  36.       $this->length = $this->model->returnLength($this->string);
  37.     }
  38.  
  39.     function echoLength()
  40.     {
  41.       require_once '/../view/view.php';
  42.       $this->view = new View($this->length);
  43.     }
  44.  
  45.   } // ./CONTROLLER
  46.  
  47.  
  48. /*
  49. * MODEL
  50. */
  51.   class Model
  52.   {
  53.     public function returnLength($string)
  54.     {
  55.       return strlen($string);
  56.     }
  57.  
  58.   } // ./MODEL
  59.  
  60.  
  61. /*
  62. * VIEW
  63. */
  64.   class View
  65.   {
  66.     function __construct($strlen)
  67.     {
  68.       echo $strlen;
  69.     }
  70.   }
  71.  
  72. ?>
Advertisement
Add Comment
Please, Sign In to add comment