generated from spatie/package-skeleton-laravel
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1131dd8
commit 59ecdb3
Showing
2 changed files
with
70 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
namespace Elegantly\Referrer\Sources; | ||
|
||
use Illuminate\Http\Request; | ||
|
||
/** | ||
* @see https://business-api.tiktok.com/portal/docs?id=1771100879787009 | ||
* | ||
* @extends ReferrerSource<string|null> | ||
*/ | ||
class TikTokClickIdSource extends ReferrerSource | ||
{ | ||
final public function __construct( | ||
public ?string $ttclid = null, | ||
|
||
) { | ||
// | ||
} | ||
|
||
public function isEmpty(): bool | ||
{ | ||
return blank($this->ttclid); | ||
} | ||
|
||
public static function fromRequest(Request $request): static | ||
{ | ||
return new static( | ||
ttclid: $request->string('ttclid')->value() ?: null, | ||
); | ||
} | ||
|
||
/** | ||
* @param array{ | ||
* ttclid?: string|null, | ||
* } $values | ||
*/ | ||
public static function fromArray(array $values): static | ||
{ | ||
return new static( | ||
ttclid: $values['ttclid'] ?? null, | ||
); | ||
} | ||
|
||
/** | ||
* @return array{ | ||
* ttclid?: string|null, | ||
* } | ||
*/ | ||
public function toArray(): array | ||
{ | ||
return [ | ||
'ttclid' => $this->ttclid, | ||
]; | ||
} | ||
} |