Skip to content

Commit b3e4997

Browse files
committed
switch from string to instanceof check to allow stringable objects
1 parent 13aa935 commit b3e4997

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

src/Type.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ public function alternateLocale(string $locale)
7878
public function image($image)
7979
{
8080
$this->addStructuredProperty(
81-
is_string($image)
82-
? Image::make($image)
83-
: $image
81+
$image instanceof Image
82+
? $image
83+
: Image::make($image)
8484
);
8585

8686
return $this;
@@ -93,9 +93,9 @@ public function image($image)
9393
public function video($video)
9494
{
9595
$this->addStructuredProperty(
96-
is_string($video)
97-
? Image::make($video)
98-
: $video
96+
$video instanceof Video
97+
? $video
98+
: Video::make($video)
9999
);
100100

101101
return $this;
@@ -108,9 +108,9 @@ public function video($video)
108108
public function audio($audio)
109109
{
110110
$this->addStructuredProperty(
111-
is_string($audio)
112-
? Image::make($audio)
113-
: $audio
111+
$audio instanceof Audio
112+
? $audio
113+
: Audio::make($audio)
114114
);
115115

116116
return $this;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
2+
<html><head>
3+
<meta property="og:type" content="website">
4+
<meta property="og:title" content="Title | Example">
5+
<meta property="og:url" content="http://www.example.com">
6+
<meta property="og:description" content="Description">
7+
<meta property="og:locale" content="en_US">
8+
<meta property="og:locale:alternate" content="en_GB">
9+
<meta property="og:site_name" content="Example">
10+
<meta property="og:image:url" content="http://www.example.com/image1.jpg">
11+
</head></html>

0 commit comments

Comments
 (0)