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
3f1e3c7
commit 3f45aae
Showing
4 changed files
with
254 additions
and
76 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,38 @@ | ||
<?php | ||
|
||
namespace Elegantly\Seo; | ||
|
||
use Elegantly\Seo\OpenGraph\Image; | ||
use Elegantly\Seo\Twitter\Image as TwitterImage; | ||
|
||
class SeoImage | ||
{ | ||
public function __construct( | ||
public string $url, | ||
public ?string $secure_url = null, | ||
public ?string $type = null, | ||
public ?string $width = null, | ||
public ?string $height = null, | ||
public ?string $alt = null, | ||
) {} | ||
|
||
public function toOpenGraph(): Image | ||
{ | ||
return new Image( | ||
url: $this->url, | ||
secure_url: $this->secure_url, | ||
type: $this->type, | ||
width: $this->width, | ||
height: $this->height, | ||
alt: $this->alt, | ||
); | ||
} | ||
|
||
public function toTwitter(): TwitterImage | ||
{ | ||
return new TwitterImage( | ||
url: $this->secure_url ?? $this->url, | ||
alt: $this->alt | ||
); | ||
} | ||
} |
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