Файловый менеджер - Редактировать - /home/freeclou/app.optimyar.com/front-web/build/assets/fonts/iran-yekan/beflpn/Traits.zip
Назад
PK �bm[�E�t� � ErrorLoggerTrait.phpnu ȯ�� <?php namespace WP_Statistics\Traits; use WP_Statistics\Service\Debugger\Provider\ErrorsDetectorProvider; /** * Trait for handling error logging functionality. * * This trait provides methods for logging errors consistently across classes. * Uses ErrorDetectorProvider to store errors and implements basic caching * to avoid creating multiple provider instances. */ trait ErrorLoggerTrait { /** * Cached instance of ErrorDetectorProvider. * * @var ErrorsDetectorProvider|null */ private static $errorDetector = null; /** * Log errors using ErrorsDetectorProvider * * Logs the most recent PHP error using a cached instance * of ErrorsDetectorProvider to avoid multiple instantiations. * * @return void */ protected static function errorListener() { if (self::$errorDetector === null) { self::$errorDetector = new ErrorsDetectorProvider(); } self::$errorDetector->errorListener(); } }PK �bm[� �� � ObjectCacheTrait.phpnu ȯ�� <?php namespace WP_Statistics\Traits; /** * Trait to handle caching logic. * @doc https://github.com/wp-statistics/wp-statistics/wiki/ObjectCacheTrait.md */ trait ObjectCacheTrait { /** * Cached data to prevent duplicate queries. * * @var array */ private $cache = []; /** * Sets a value in the cache. * * @param string $key The cache key. * @param mixed $value The value to cache. * * @return void */ public function setCache($key, $value) { $this->cache[$key] = $value; } /** * Gets a value from the cache. * * @param string $key The cache key. * * @return mixed|null The cached value or null if not set. */ public function getCache($key, $default = null) { return $this->isCacheSet($key) ? $this->cache[$key] : $default; } /** * Checks if a cache key is set. * * @param string $key The cache key. * * @return bool True if the cache key is set, false otherwise. */ public function isCacheSet($key) { return isset($this->cache[$key]); } /** * Resets the cache. * * @return void */ public function resetCache() { $this->cache = []; } /** * Fetches data from the model with caching. * * @param string $key Cache key. * @param callable $callback Function to fetch data if not cached. * * @return mixed Cached or fetched data. */ public function getCachedData($key, callable $callback) { if (!$this->isCacheSet($key)) { $this->setCache($key, $callback()); } return $this->getCache($key); } } PK �bm[��P� � TransientCacheTrait.phpnu ȯ�� <?php namespace WP_Statistics\Traits; /** * Trait to handle caching logic. * @doc https://github.com/wp-statistics/wp-statistics/wiki/TransientCacheTrait.md */ trait TransientCacheTrait { /** * Get the cache key for the given input. * * @param string $input * * @return string */ public function getCacheKey($input) { $hash = substr(md5($input), 0, 10); return sprintf('wp_statistics_cache_%s', $hash); } /** * Get the cached result for the given input. * * @param string $input * * @return mixed */ public function getCachedResult($input) { $cacheKey = $this->getCacheKey($input); return get_transient($cacheKey); } /** * Set the cached result for the given input. * * @param string $input * @param mixed $result * @param int $expiration Expiration time for the cache in seconds. * * @return bool */ public function setCachedResult($input, $result, $expiration = DAY_IN_SECONDS) { $cacheKey = $this->getCacheKey($input); return set_transient($cacheKey, $result, $expiration); } /** * Clear the cached result for the given input. * * @param string $input * * @return bool */ protected function clearCachedResult($input) { $cacheKey = $this->getCacheKey($input); return delete_transient($cacheKey); } } PK �bm[�E�t� � ErrorLoggerTrait.phpnu ȯ�� PK �bm[� �� � " ObjectCacheTrait.phpnu ȯ�� PK �bm[��P� � $ TransientCacheTrait.phpnu ȯ�� PK � '
| ver. 1.4 |
Github
|
.
| PHP 8.1.33 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка