Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
ConfigValue.php
001 <?php
002
003 /**
004 * @package s9e\TextFormatter
005 * @copyright Copyright (c) 2010-2022 The s9e authors
006 * @license http://www.opensource.org/licenses/mit-license.php The MIT License
007 */
008 namespace s9e\TextFormatter\Configurator\JavaScript;
009
010 class ConfigValue
011 {
012 /**
013 * @var bool
014 */
015 protected $isDeduplicated = false;
016
017 /**
018 * @var string Name of the variable that holds this value
019 */
020 protected $name;
021
022 /**
023 * @var integer Number of times this value is used or referenced
024 */
025 protected $useCount = 0;
026
027 /**
028 * @var array|Code|Dictionary Original value
029 */
030 protected $value;
031
032 /**
033 * @var string
034 */
035 protected $varName;
036
037 /**
038 * Constructor
039 *
040 * @param array|Code|Dictionary $value Original value
041 * @param string $varName
042 */
043 public function __construct($value, $varName)
044 {
045 $this->value = $value;
046 $this->varName = $varName;
047 }
048
049 /**
050 * Mark this value as deduplicated if it's been used more than once
051 *
052 * @return void
053 */
054 public function deduplicate()
055 {
056 if ($this->useCount > 1)
057 {
058 $this->isDeduplicated = true;
059 $this->decrementUseCount($this->useCount - 1);
060 }
061 }
062
063 /**
064 * Return the number of times this value has been used or referenced
065 *
066 * @return integer
067 */
068 public function getUseCount()
069 {
070 return $this->useCount;
071 }
072
073 /**
074 * Return the PHP value held by this instance
075 *
076 * @return array|Code|Dictionary
077 */
078 public function getValue()
079 {
080 return $this->value;
081 }
082
083 /**
084 * Return the variable name assigned to this value
085 *
086 * @return string
087 */
088 public function getVarName()
089 {
090 return $this->varName;
091 }
092
093 /**
094 * Increment the use counter
095 *
096 * @return void
097 */
098 public function incrementUseCount()
099 {
100 ++$this->useCount;
101 }
102
103 /**
104 * Return whether this value is marked as deduplicated
105 *
106 * @return bool
107 */
108 public function isDeduplicated()
109 {
110 return $this->isDeduplicated;
111 }
112
113 /**
114 * Decrement the use counter of this value as well as the values it contains
115 *
116 * @param integer $step How much to remove from the counter
117 * @return void
118 */
119 protected function decrementUseCount($step = 1)
120 {
121 $this->useCount -= $step;
122 foreach ($this->value as $value)
123 {
124 if ($value instanceof ConfigValue)
125 {
126 $value->decrementUseCount($step);
127 }
128 }
129 }
130 }