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
6d884e4
commit 99b4bb9
Showing
4 changed files
with
120 additions
and
2 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
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://support.google.com/google-ads/answer/3095550 | ||
* | ||
* @extends ReferrerSource<string|null> | ||
*/ | ||
class GoogleClickIdSource extends ReferrerSource | ||
{ | ||
final public function __construct( | ||
public ?string $gclid = null, | ||
|
||
) { | ||
// | ||
} | ||
|
||
public function isEmpty(): bool | ||
{ | ||
return blank($this->gclid); | ||
} | ||
|
||
public static function fromRequest(Request $request): static | ||
{ | ||
return new static( | ||
gclid: $request->string('gclid')->value() ?: null, | ||
); | ||
} | ||
|
||
/** | ||
* @param array{ | ||
* gclid?: string|null, | ||
* } $values | ||
*/ | ||
public static function fromArray(array $values): static | ||
{ | ||
return new static( | ||
gclid: $values['gclid'] ?? null, | ||
); | ||
} | ||
|
||
/** | ||
* @return array{ | ||
* gclid?: string|null, | ||
* } | ||
*/ | ||
public function toArray(): array | ||
{ | ||
return [ | ||
'gclid' => $this->gclid, | ||
]; | ||
} | ||
} |
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://developers.facebook.com/docs/marketing-api/conversions-api/parameters/fbp-and-fbc/ | ||
* | ||
* @extends ReferrerSource<string|null> | ||
*/ | ||
class MetaClickIdSource extends ReferrerSource | ||
{ | ||
final public function __construct( | ||
public ?string $fbclid = null, | ||
|
||
) { | ||
// | ||
} | ||
|
||
public function isEmpty(): bool | ||
{ | ||
return blank($this->fbclid); | ||
} | ||
|
||
public static function fromRequest(Request $request): static | ||
{ | ||
return new static( | ||
fbclid: $request->string('fbclid')->value() ?: null, | ||
); | ||
} | ||
|
||
/** | ||
* @param array{ | ||
* fbclid?: string|null, | ||
* } $values | ||
*/ | ||
public static function fromArray(array $values): static | ||
{ | ||
return new static( | ||
fbclid: $values['fbclid'] ?? null, | ||
); | ||
} | ||
|
||
/** | ||
* @return array{ | ||
* fbclid?: string|null, | ||
* } | ||
*/ | ||
public function toArray(): array | ||
{ | ||
return [ | ||
'fbclid' => $this->fbclid, | ||
]; | ||
} | ||
} |