Warning: chmod(): Operation not permitted in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8 [0] in function chmod in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8 [1] in function include_once in /var/www/hopeinstoughton_www/wp-settings.php on line 560 [2] in function require_once in /var/www/hopeinstoughton_www/wp-config.php on line 85 [3] in function require_once in /var/www/hopeinstoughton_www/wp-load.php on line 50 [4] in function require_once in /var/www/hopeinstoughton_www/wp-blog-header.php on line 13 [5] in function require in /var/www/hopeinstoughton_www/index.php on line 17
| Server IP : 94.177.8.99 / Your IP : 216.73.217.165 Web Server : Apache/2.4.58 (Ubuntu) System : Linux aries 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/hopeinstoughton_www/wp-content/plugins/his-schedule/PhpSpreadsheet/ |
Upload File : |
<?php
namespace PhpOffice\PhpSpreadsheet;
class HashTable
{
/**
* HashTable elements.
*
* @var IComparable[]
*/
protected $items = [];
/**
* HashTable key map.
*
* @var string[]
*/
protected $keyMap = [];
/**
* Create a new \PhpOffice\PhpSpreadsheet\HashTable.
*
* @param IComparable[] $pSource Optional source array to create HashTable from
*
* @throws Exception
*/
public function __construct($pSource = null)
{
if ($pSource !== null) {
// Create HashTable
$this->addFromSource($pSource);
}
}
/**
* Add HashTable items from source.
*
* @param IComparable[] $pSource Source array to create HashTable from
*
* @throws Exception
*/
public function addFromSource(array $pSource = null)
{
// Check if an array was passed
if ($pSource == null) {
return;
}
foreach ($pSource as $item) {
$this->add($item);
}
}
/**
* Add HashTable item.
*
* @param IComparable $pSource Item to add
*/
public function add(IComparable $pSource)
{
$hash = $pSource->getHashCode();
if (!isset($this->items[$hash])) {
$this->items[$hash] = $pSource;
$this->keyMap[count($this->items) - 1] = $hash;
}
}
/**
* Remove HashTable item.
*
* @param IComparable $pSource Item to remove
*/
public function remove(IComparable $pSource)
{
$hash = $pSource->getHashCode();
if (isset($this->items[$hash])) {
unset($this->items[$hash]);
$deleteKey = -1;
foreach ($this->keyMap as $key => $value) {
if ($deleteKey >= 0) {
$this->keyMap[$key - 1] = $value;
}
if ($value == $hash) {
$deleteKey = $key;
}
}
unset($this->keyMap[count($this->keyMap) - 1]);
}
}
/**
* Clear HashTable.
*/
public function clear()
{
$this->items = [];
$this->keyMap = [];
}
/**
* Count.
*
* @return int
*/
public function count()
{
return count($this->items);
}
/**
* Get index for hash code.
*
* @param string $pHashCode
*
* @return int Index
*/
public function getIndexForHashCode($pHashCode)
{
return array_search($pHashCode, $this->keyMap);
}
/**
* Get by index.
*
* @param int $pIndex
*
* @return IComparable
*/
public function getByIndex($pIndex)
{
if (isset($this->keyMap[$pIndex])) {
return $this->getByHashCode($this->keyMap[$pIndex]);
}
return null;
}
/**
* Get by hashcode.
*
* @param string $pHashCode
*
* @return IComparable
*/
public function getByHashCode($pHashCode)
{
if (isset($this->items[$pHashCode])) {
return $this->items[$pHashCode];
}
return null;
}
/**
* HashTable to array.
*
* @return IComparable[]
*/
public function toArray()
{
return $this->items;
}
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {
$this->$key = clone $value;
}
}
}
}