[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/joomla/uri/src/ -> UriImmutable.php (source)

   1  <?php
   2  /**
   3   * Part of the Joomla Framework Uri Package
   4   *
   5   * @copyright  Copyright (C) 2005 - 2022 Open Source Matters, Inc. All rights reserved.
   6   * @license    GNU General Public License version 2 or later; see LICENSE
   7   */
   8  
   9  namespace Joomla\Uri;
  10  
  11  /**
  12   * UriImmutable Class
  13   *
  14   * This is an immutable version of the AbstractUri class.
  15   *
  16   * @since  1.0
  17   */
  18  final class UriImmutable extends AbstractUri
  19  {
  20      /**
  21       * Flag if the class been instantiated
  22       *
  23       * @var    boolean
  24       * @since  1.0
  25       */
  26      private $constructed = false;
  27  
  28      /**
  29       * Prevent setting undeclared properties.
  30       *
  31       * @param   string  $name   This is an immutable object, setting $name is not allowed.
  32       * @param   mixed   $value  This is an immutable object, setting $value is not allowed.
  33       *
  34       * @return  void  This method always throws an exception.
  35       *
  36       * @since   1.0
  37       * @throws  \BadMethodCallException
  38       */
  39  	public function __set($name, $value)
  40      {
  41          throw new \BadMethodCallException('This is an immutable object');
  42      }
  43  
  44      /**
  45       * This is a special constructor that prevents calling the __construct method again.
  46       *
  47       * @param   string  $uri  The optional URI string
  48       *
  49       * @since   1.0
  50       * @throws  \BadMethodCallException
  51       */
  52  	public function __construct($uri = null)
  53      {
  54          if ($this->constructed === true)
  55          {
  56              throw new \BadMethodCallException('This is an immutable object');
  57          }
  58  
  59          $this->constructed = true;
  60  
  61          parent::__construct($uri);
  62      }
  63  }


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