Writes a cookie, or overwrites an existing one

@param string   $sKey   The cookie's key
@param string   $sValue The cookie's value
@param int|null $iTTL   The cookie's TTL in seconds

@return bool
192175
public function write(
        string $sKey,
        string $sValue,
        int $iTTL = null,
        string $sPath = '',
        string $sDomain = '',
        bool $bSecure = false,
        bool $bHttpOnly = false
    ): bool {
        if (setcookie($sKey, $sValue, $iTTL ? time() + $iTTL : 0, $sPath, $sDomain, $bSecure, $bHttpOnly)) {
            $this->aCookies[$sKey] = Factory::resource(
                'Cookie',
                null,
                (object) [
                    'key'   => $sKey,
                    'value' => $sValue,
                ]
            );
            return true;
        }

        return false;
    }
945484
public function setRawCookie($key, $value, $expires = null, $domain = '-', $path = '/')
    {
        $domain = strtolower($domain);
        if (substr($domain, 0, 1) === '.') {
            $domain = substr($domain, 1);
        }
        if (!isset($this->_cookies[$domain])) {
            $this->_cookies[$domain] = [];
        }
        if (!isset($this->_cookies[$domain][$path])) {
            $this->_cookies[$domain][$path] = [];
        }
        $list = &$this->_cookies[$domain][$path];
        if ($value === null || $value === '' || ($expires !== null && $expires < time())) {
            unset($list[$key]);
        } else {
            $list[$key] = ['value' => $value, 'expires' => $expires];
        }
    }
1165839
public function setCookie( $key, $val, $lifetime = 2592000, $track = TSINT_COOKIE_TRACK ) {
		// Validate cookie name
		$name = $this->getCookieName( $key );
		if ( !$name ) {
			return false;
		}

		$val = strval( $val );
		$lifetime = intval( $lifetime );
		$expire = time() + $lifetime;

		// Set a 30-day domain-wide cookie
		setcookie( $name, $val, $expire, '/' );

		// In order to keep track of the expiration date, we set another cookie
		if ( $track === TSINT_COOKIE_TRACK ) {
			$this->setExpiryTrackerCookie( $lifetime );
		}

		return true;
	}
1074948
public function write($key, $value, $ttl = 0)
    {
        $this->redis->set($this->prefix . $key, is_numeric($value) ? $value : serialize($value));
        if ($ttl != 0) {
            $this->redis->expire($this->prefix . $key, $ttl);
        }
        return true;
    }
795259
public function write($sessionId, $data)
    {
        $t = microtime(true);
        $expiration = $this->_lifeTime + time();
 
        //we store time of the db record expiration in the Memcache
        if ($this->_initSessionData !== $data) {
            Kwf_Registry::get('db')->query("REPLACE INTO kwf_sessions (sessionId, expiration, data) VALUES(?, ?, ?)", array($sessionId, $expiration, $data));
            $this->_memcacheSet($sessionId, $data);
        }
        Kwf_Benchmark::count('sessionhdl', 'read: '.((microtime(true)-$t)*1000).'ms');
        return true;
    }
101539
public function string2Float($sValue)
    {
        $fRet = str_replace(" ", "", $sValue);
        $iCommaPos = strpos($fRet, ",");
        $iDotPos = strpos($fRet, ".");
        if (!$iDotPos xor !$iCommaPos) {
            if (substr_count($fRet, ",") > 1 || substr_count($fRet, ".") > 1) {
                $fRet = str_replace([",", "."], "", $fRet);
            } else {
                $fRet = str_replace(",", ".", $fRet);
            }
        } else {
            if ($iDotPos < $iCommaPos) {
                $fRet = str_replace(".", "", $fRet);
                $fRet = str_replace(",", ".", $fRet);
            }
        }

        // remove thousands
        return (float) str_replace([" ", ","], "", $fRet);
    }
940787
public static function put($arTags, $sKeys, &$arValue, $iMinute)
    {
        $obDate = Carbon::now()->addMinute($iMinute);

        $sCacheDriver = config('cache.default');
        if(!empty($arTags)) {
            if($sCacheDriver == 'redis') {
                Cache::tags($arTags)->put($sKeys, $arValue, $obDate);
                return;
            } else {
                $sKeys = implode('_', $arTags).'_'.$sKeys;
            }
        }

        Cache::put($sKeys, $arValue, $obDate);
    }
602355
public function delete(string $sKey): bool
    {
        if (array_key_exists($sKey, $this->aCookies) && setcookie($sKey, '', 1)) {
            unset($this->aCookies[$sKey]);
            return true;
        }

        return false;
    }
108776
public function set(CacheKey $key, $value, $sessionLength = null) {

        if ($sessionLength == null) {
            $sessionLength = $this->timeThreshold;
        }

        $sKey = $this->getKey($key);

        if (is_array($value) || is_object($value)) {
            $value = serialize($value);
        }

        $this->redis->set($sKey, $value);

        if (!empty($sessionLength) && $sessionLength > 0) {
            $this->redis->expire($sKey, $sessionLength);
        }
    }
615311
public function set($key, $value, $ttl = null)
	{
		return $this->_set($key, $value, $ttl, false);
	}
515747
@Nonnull
  public FineUploader5Session addParam (@Nonnull @Nonempty final String sKey, @Nonnull final String sValue)
  {
    ValueEnforcer.notEmpty (sKey, "Key");
    ValueEnforcer.notNull (sValue, "Value");

    m_aSessionParams.put (sKey, sValue);
    return this;
  }
1361087
protected function _isObjectFieldWithValidValue( $sKey, $sValue, $aMap, $oObject )
    {
        if ( !array_key_exists( $sKey, $aMap ) ) {
            return false;
        }

        $sField = $aMap[$sKey];

        if ( empty( $sValue ) or ( $oObject->$sField->value == $sValue ) ) {
            return false;
        }

        return true;
    }
332823
public function read(string $sKey): ?Item
    {
        return $this->exists($sKey) ? $this->newItem($sKey) : null;
    }
1300732
public function addToList($sKey, $sValue)
    {
        if (empty($sKey) || empty($sValue)) {
            return;
        }

        //Get value from storage
        $arValueList = $this->getList($sKey);

        array_unshift($arValueList, $sValue);
        $arValueList = array_unique($arValueList);

        $this->put($sKey, $arValueList);
    }
107857
public static function Join($sKey, $sAppend){
            $oThis = self::CreateInstanceIfNotExists();
            return (array_key_exists($sKey, $oThis->aList)) ? ((is_string($oThis->aList[$sKey])) ? $oThis->aList[$sKey].$sAppend : false)  : false;
        }
1313317
public function get($sKey, $sDefaultValue = null)
    {
        if (empty($sKey)) {
            return $sDefaultValue;
        }

        $obValue = Cookie::get($sKey);
        if (empty($obValue)) {
            return $sDefaultValue;
        }

        return $obValue;
    }
316627
public function ifne($sValue1, $sValue2)
    {
        $this->sCondition = '(' . Parameter::make($sValue1) . '!=' . Parameter::make($sValue2) . ')';
        return $this;
    }