<?php declare(strict_types=1); namespace MailPoet\Statistics; if (!defined('ABSPATH')) exit; use MailPoet\Doctrine\Repository; use MailPoet\Entities\UserAgentEntity; /** * @extends Repository<UserAgentEntity> */ class UserAgentsRepository extends Repository { protected function getEntityClassName() { return UserAgentEntity::class; } public function findOrCreate(string $userAgent): UserAgentEntity { $hash = (string)crc32($userAgent); $userAgentEntity = $this->findOneBy(['hash' => $hash]); if ($userAgentEntity) return $userAgentEntity; $userAgentEntity = new UserAgentEntity($userAgent); $this->persist($userAgentEntity); return $userAgentEntity; } }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
Track | Folder | 0755 |
|
|
GATracking.php | File | 3.12 KB | 0644 |
|
StatisticsBouncesRepository.php | File | 388 B | 0644 |
|
StatisticsClicksRepository.php | File | 1.99 KB | 0644 |
|
StatisticsFormsRepository.php | File | 1.07 KB | 0644 |
|
StatisticsOpensRepository.php | File | 3.95 KB | 0644 |
|
StatisticsUnsubscribesRepository.php | File | 375 B | 0644 |
|
StatisticsWooCommercePurchasesRepository.php | File | 407 B | 0644 |
|
UserAgentsRepository.php | File | 699 B | 0644 |
|
index.php | File | 0 B | 0644 |
|