Skip to content

Commit dd13ee5

Browse files
committed
Implemented PayloadGenerator
1 parent b856ab4 commit dd13ee5

File tree

13 files changed

+434
-111
lines changed

13 files changed

+434
-111
lines changed

src/DiscordWebhook/Embed/Author.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,27 @@ class Author
1818
use IconTrait;
1919

2020
/**
21-
* @var string
21+
* @var string|null
2222
*/
2323
private $url;
24+
25+
/**
26+
* @return string|null
27+
*/
28+
public function getUrl(): ?string
29+
{
30+
return $this->url;
31+
}
32+
33+
/**
34+
* @param string|null $url
35+
*
36+
* @return Author
37+
*/
38+
public function setUrl(?string $url): Author
39+
{
40+
$this->url = $url;
41+
42+
return $this;
43+
}
2444
}

src/DiscordWebhook/Embed/Field.php

Lines changed: 65 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
namespace DiscordWebhook\Embed;
55

6-
use DiscordWebhook\Embed\Traits\NameableTrait;
7-
86
/**
97
* Class Field
108
*
@@ -13,15 +11,78 @@
1311
*/
1412
class Field
1513
{
16-
use NameableTrait;
14+
/**
15+
* @var string
16+
*/
17+
private $name;
1718

1819
/**
1920
* @var string
2021
*/
2122
private $value;
2223

2324
/**
24-
* @var bool
25+
* @var bool|null
2526
*/
2627
private $isInline;
28+
29+
/**
30+
* @return string
31+
*/
32+
public function getName(): string
33+
{
34+
return $this->name;
35+
}
36+
37+
/**
38+
* @param string $name
39+
*
40+
* @return self
41+
*/
42+
public function setName(string $name): self
43+
{
44+
$this->name = $name;
45+
46+
return $this;
47+
}
48+
49+
/**
50+
* @return string
51+
*/
52+
public function getValue(): string
53+
{
54+
return $this->value;
55+
}
56+
57+
/**
58+
* @param string $value
59+
*
60+
* @return self
61+
*/
62+
public function setValue(string $value): self
63+
{
64+
$this->value = $value;
65+
66+
return $this;
67+
}
68+
69+
/**
70+
* @return bool|null
71+
*/
72+
public function getIsInline(): ?bool
73+
{
74+
return $this->isInline;
75+
}
76+
77+
/**
78+
* @param bool|null $isInline
79+
*
80+
* @return self
81+
*/
82+
public function setIsInline(?bool $isInline): self
83+
{
84+
$this->isInline = $isInline;
85+
86+
return $this;
87+
}
2788
}

src/DiscordWebhook/Embed/Footer.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,24 @@ class Footer
1919
* @var string
2020
*/
2121
private $text;
22+
23+
/**
24+
* @return string
25+
*/
26+
public function getText(): string
27+
{
28+
return $this->text;
29+
}
30+
31+
/**
32+
* @param string $text
33+
*
34+
* @return self
35+
*/
36+
public function setText(string $text): self
37+
{
38+
$this->text = $text;
39+
40+
return $this;
41+
}
2242
}

src/DiscordWebhook/Embed/Provider.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,27 @@ class Provider
1616
use NameableTrait;
1717

1818
/**
19-
* @var string
19+
* @var string|null
2020
*/
2121
private $url;
22+
23+
/**
24+
* @return string|null
25+
*/
26+
public function getUrl(): ?string
27+
{
28+
return $this->url;
29+
}
30+
31+
/**
32+
* @param string|null $url
33+
*
34+
* @return self
35+
*/
36+
public function setUrl(?string $url): self
37+
{
38+
$this->url = $url;
39+
40+
return $this;
41+
}
2242
}

src/DiscordWebhook/Embed/Traits/IconTrait.php

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,52 @@
1212
trait IconTrait
1313
{
1414
/**
15-
* @var string
15+
* @var string|null
1616
*/
1717
private $iconUrl;
1818

1919
/**
20-
* @var string
20+
* @var string|null
2121
*/
2222
private $proxyIconUrl;
23+
24+
/**
25+
* @return string|null
26+
*/
27+
public function getIconUrl(): ?string
28+
{
29+
return $this->iconUrl;
30+
}
31+
32+
/**
33+
* @param string|null $iconUrl
34+
*
35+
* @return self
36+
*/
37+
public function setIconUrl(?string $iconUrl): self
38+
{
39+
$this->iconUrl = $iconUrl;
40+
41+
return $this;
42+
}
43+
44+
/**
45+
* @return string|null
46+
*/
47+
public function getProxyIconUrl(): ?string
48+
{
49+
return $this->proxyIconUrl;
50+
}
51+
52+
/**
53+
* @param string|null $proxyIconUrl
54+
*
55+
* @return self
56+
*/
57+
public function setProxyIconUrl(?string $proxyIconUrl): self
58+
{
59+
$this->proxyIconUrl = $proxyIconUrl;
60+
61+
return $this;
62+
}
2363
}

src/DiscordWebhook/Embed/Traits/LinkableTrait.php

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,52 @@
1212
trait LinkableTrait
1313
{
1414
/**
15-
* @var string
15+
* @var string|null
1616
*/
1717
private $url;
1818

1919
/**
20-
* @var string
20+
* @var string|null
2121
*/
2222
private $proxyUrl;
23+
24+
/**
25+
* @return string|null
26+
*/
27+
public function getUrl(): ?string
28+
{
29+
return $this->url;
30+
}
31+
32+
/**
33+
* @param string|null $url
34+
*
35+
* @return self
36+
*/
37+
public function setUrl(?string $url): self
38+
{
39+
$this->url = $url;
40+
41+
return $this;
42+
}
43+
44+
/**
45+
* @return string|null
46+
*/
47+
public function getProxyUrl(): ?string
48+
{
49+
return $this->proxyUrl;
50+
}
51+
52+
/**
53+
* @param string|null $proxyUrl
54+
*
55+
* @return self
56+
*/
57+
public function setProxyUrl(?string $proxyUrl): self
58+
{
59+
$this->proxyUrl = $proxyUrl;
60+
61+
return $this;
62+
}
2363
}

src/DiscordWebhook/Embed/Traits/NameableTrait.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,27 @@
1212
trait NameableTrait
1313
{
1414
/**
15-
* @var string
15+
* @var string|null
1616
*/
1717
private $name;
18+
19+
/**
20+
* @return string|null
21+
*/
22+
public function getName(): ?string
23+
{
24+
return $this->name;
25+
}
26+
27+
/**
28+
* @param string|null $name
29+
*
30+
* @return self
31+
*/
32+
public function setName(?string $name): self
33+
{
34+
$this->name = $name;
35+
36+
return $this;
37+
}
1838
}

src/DiscordWebhook/Embed/Traits/ResizableTrait.php

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,52 @@
1212
trait ResizableTrait
1313
{
1414
/**
15-
* @var int
15+
* @var int|null
1616
*/
1717
private $width;
1818

1919
/**
20-
* @var int
20+
* @var int|null
2121
*/
2222
private $height;
23+
24+
/**
25+
* @return int|null
26+
*/
27+
public function getWidth(): ?int
28+
{
29+
return $this->width;
30+
}
31+
32+
/**
33+
* @param int|null $width
34+
*
35+
* @return self
36+
*/
37+
public function setWidth(?int $width): self
38+
{
39+
$this->width = $width;
40+
41+
return $this;
42+
}
43+
44+
/**
45+
* @return int|null
46+
*/
47+
public function getHeight(): ?int
48+
{
49+
return $this->height;
50+
}
51+
52+
/**
53+
* @param int|null $height
54+
*
55+
* @return self
56+
*/
57+
public function setHeight(?int $height): self
58+
{
59+
$this->height = $height;
60+
61+
return $this;
62+
}
2363
}

src/DiscordWebhook/Embed/Video.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,27 @@ class Video
1616
use ResizableTrait;
1717

1818
/**
19-
* @var string
19+
* @var string|null
2020
*/
2121
private $url;
22+
23+
/**
24+
* @return string|null
25+
*/
26+
public function getUrl(): ?string
27+
{
28+
return $this->url;
29+
}
30+
31+
/**
32+
* @param string|null $url
33+
*
34+
* @return self
35+
*/
36+
public function setUrl(?string $url): self
37+
{
38+
$this->url = $url;
39+
40+
return $this;
41+
}
2242
}

0 commit comments

Comments
 (0)