Textpattern PHP Cross Reference Content Management Systems

Source: /textpattern/vendors/Textpattern/Container/ReusableInterface.php - 58 lines - 1613 bytes - Text - Print

Description: Signals to the factory that the instance can be reused.

   1  <?php
   2  
   3  /*
   4   * Textpattern Content Management System
   5   * http://textpattern.com
   6   *
   7   * Copyright (C) 2016 The Textpattern Development Team
   8   *
   9   * This file is part of Textpattern.
  10   *
  11   * Textpattern is free software; you can redistribute it and/or
  12   * modify it under the terms of the GNU General Public License
  13   * as published by the Free Software Foundation, version 2.
  14   *
  15   * Textpattern is distributed in the hope that it will be useful,
  16   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18   * GNU General Public License for more details.
  19   *
  20   * You should have received a copy of the GNU General Public License
  21   * along with Textpattern. If not, see <http://www.gnu.org/licenses/>.
  22   */
  23  
  24  /**
  25   * Signals to the factory that the instance can be reused.
  26   *
  27   * Instances of this interface are treated as static. Once you initialise the
  28   * instance, it's kept and used again each time you reference the class using
  29   * the factory.
  30   *
  31   * For instance, the following will remember the initial value:
  32   *
  33   * <code>
  34   * class Abc_Class implements \Textpattern\Container\ReusableInterface
  35   * {
  36   *     public $random;
  37   *     public function __construct()
  38   *     {
  39   *         $this->random = rand();
  40   *     }
  41   * }
  42   * echo Txp::get('Abc_Class')->random;
  43   * echo Txp::get('Abc_Class')->random;
  44   * echo Txp::get('Abc_Class')->random;
  45   * </code>
  46   *
  47   * All three calls return the same Abc_Class::$random as the instance is kept
  48   * between calls.
  49   *
  50   * @since   4.6.0
  51   * @package Container
  52   */
  53  
  54  namespace Textpattern\Container;
  55  
  56  interface ReusableInterface
  57  {
  58  }

title

Description

title

Description

title

Description

title

title

Body