Source for file base.php

Documentation is available at base.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Platform
  4.  * @subpackage  Model
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE
  8.  */
  9.  
  10. defined('JPATH_PLATFORM'or die;
  11.  
  12. /**
  13.  * Joomla Platform Base Model Class
  14.  *
  15.  * @package     Joomla.Platform
  16.  * @subpackage  Model
  17.  * @since       12.1
  18.  */
  19. abstract class JModelBase implements JModel
  20. {
  21.     /**
  22.      * The model state.
  23.      *
  24.      * @var    JRegistry 
  25.      * @since  12.1
  26.      */
  27.     protected $state;
  28.  
  29.     /**
  30.      * Instantiate the model.
  31.      *
  32.      * @param   JRegistry  $state  The model state.
  33.      *
  34.      * @since   12.1
  35.      */
  36.     public function __construct(JRegistry $state null)
  37.     {
  38.         // Setup the model.
  39.         $this->state = isset($state$state $this->loadState();
  40.     }
  41.  
  42.     /**
  43.      * Get the model state.
  44.      *
  45.      * @return  JRegistry  The state object.
  46.      *
  47.      * @since   12.1
  48.      */
  49.     public function getState()
  50.     {
  51.         return $this->state;
  52.     }
  53.  
  54.     /**
  55.      * Set the model state.
  56.      *
  57.      * @param   JRegistry  $state  The state object.
  58.      *
  59.      * @return  void 
  60.      *
  61.      * @since   12.1
  62.      */
  63.     public function setState(JRegistry $state)
  64.     {
  65.         $this->state = $state;
  66.     }
  67.  
  68.     /**
  69.      * Load the model state.
  70.      *
  71.      * @return  JRegistry  The state object.
  72.      *
  73.      * @since   12.1
  74.      */
  75.     protected function loadState()
  76.     {
  77.         return new JRegistry;
  78.     }
  79. }

Documentation generated on Tue, 19 Nov 2013 14:54:25 +0100 by phpDocumentor 1.4.3