[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/src/Component/ -> ComponentRecord.php (source)

   1  <?php
   2  
   3  /**
   4   * Joomla! Content Management System
   5   *
   6   * @copyright  (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
   7   * @license    GNU General Public License version 2 or later; see LICENSE.txt
   8   */
   9  
  10  namespace Joomla\CMS\Component;
  11  
  12  use Joomla\Registry\Registry;
  13  
  14  // phpcs:disable PSR1.Files.SideEffects
  15  \defined('JPATH_PLATFORM') or die;
  16  // phpcs:enable PSR1.Files.SideEffects
  17  
  18  /**
  19   * Object representing a component extension record
  20   *
  21   * @since  3.7.0
  22   */
  23  class ComponentRecord
  24  {
  25      /**
  26       * Primary key
  27       *
  28       * @var    integer
  29       * @since  3.7.0
  30       */
  31      public $id;
  32  
  33      /**
  34       * The component name
  35       *
  36       * @var    integer
  37       * @since  3.7.0
  38       */
  39      public $option;
  40  
  41      /**
  42       * The component parameters
  43       *
  44       * @var    string|Registry
  45       * @since  3.7.0
  46       * @note   This field is protected to require reading this field to proxy through the getter to convert the params to a Registry instance
  47       */
  48      protected $params;
  49  
  50      /**
  51       * The extension namespace
  52       *
  53       * @var    string
  54       * @since  4.0.0
  55       */
  56      public $namespace;
  57  
  58      /**
  59       * Indicates if this component is enabled
  60       *
  61       * @var    integer
  62       * @since  3.7.0
  63       */
  64      public $enabled;
  65  
  66      /**
  67       * Class constructor
  68       *
  69       * @param   array  $data  The component record data to load
  70       *
  71       * @since   3.7.0
  72       */
  73      public function __construct($data = array())
  74      {
  75          foreach ((array) $data as $key => $value) {
  76              $this->$key = $value;
  77          }
  78      }
  79  
  80      /**
  81       * Method to get certain otherwise inaccessible properties from the form field object.
  82       *
  83       * @param   string  $name  The property name for which to get the value.
  84       *
  85       * @return  mixed  The property value or null.
  86       *
  87       * @since   3.7.0
  88       * @deprecated  5.0  Access the item parameters through the `getParams()` method
  89       */
  90      public function __get($name)
  91      {
  92          if ($name === 'params') {
  93              return $this->getParams();
  94          }
  95  
  96          return $this->$name;
  97      }
  98  
  99      /**
 100       * Method to set certain otherwise inaccessible properties of the form field object.
 101       *
 102       * @param   string  $name   The property name for which to set the value.
 103       * @param   mixed   $value  The value of the property.
 104       *
 105       * @return  void
 106       *
 107       * @since   3.7.0
 108       * @deprecated  5.0  Set the item parameters through the `setParams()` method
 109       */
 110      public function __set($name, $value)
 111      {
 112          if ($name === 'params') {
 113              $this->setParams($value);
 114  
 115              return;
 116          }
 117  
 118          $this->$name = $value;
 119      }
 120  
 121      /**
 122       * Returns the menu item parameters
 123       *
 124       * @return  Registry
 125       *
 126       * @since   3.7.0
 127       */
 128      public function getParams()
 129      {
 130          if (!($this->params instanceof Registry)) {
 131              $this->params = new Registry($this->params);
 132          }
 133  
 134          return $this->params;
 135      }
 136  
 137      /**
 138       * Sets the menu item parameters
 139       *
 140       * @param   Registry|string  $params  The data to be stored as the parameters
 141       *
 142       * @return  void
 143       *
 144       * @since   3.7.0
 145       */
 146      public function setParams($params)
 147      {
 148          $this->params = $params;
 149      }
 150  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer