Skip to content

Commit 5e4e4b1

Browse files
chore(emoji): 📚 🔬 Add comments to all the methods
1 parent 1353110 commit 5e4e4b1

File tree

1 file changed

+27
-8
lines changed

1 file changed

+27
-8
lines changed

src/Emoji.php

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@
77
class Emoji {
88

99
/**
10-
* Quotes
11-
* @var collection
12-
*/
13-
protected $quotes;
14-
15-
/**
16-
* Get the Quotes from the respective files depending on the Category
17-
* @param string $category
10+
* Get the Emojis from emoji.php
1811
* @return array
1912
*/
2013
private function getEmojis()
2114
{
2215
return require("Emojis/emoji.php");
2316
}
2417

18+
/**
19+
* Get the emoji by passing the commonly used emoji name
20+
* @param string $emojiName
21+
* @return unicode
22+
* @throws \Unicodeveloper\Emoji\Exceptions\IsNull
23+
* @throws \Unicodeveloper\Emoji\Exceptions\UnknownUnicode
24+
*/
2525
public function findByAlias($emojiName = null)
2626
{
2727
if (is_null($emojiName)) {
@@ -37,11 +37,24 @@ public function findByAlias($emojiName = null)
3737
return $this->getEmojis()[$emoji];
3838
}
3939

40+
/**
41+
* Get the emoji by passing the commonly used emoji name
42+
* Alias for findByAlias
43+
* @param string $emojiName
44+
* @return unicode
45+
*/
4046
public function findByName($emojiName = null)
4147
{
4248
return $this->findByAlias($emojiName);
4349
}
4450

51+
/**
52+
* Get the emoji name by passing the unicode value
53+
* @param string $unicode
54+
* @return string
55+
* @throws \Unicodeveloper\Emoji\Exceptions\IsNull
56+
* @throws \Unicodeveloper\Emoji\Exceptions\UnknownUnicode
57+
*/
4558
public function findByUnicode($unicode = null)
4659
{
4760
if (is_null($unicode)) {
@@ -57,6 +70,12 @@ public function findByUnicode($unicode = null)
5770
return $emojis[$unicode];
5871
}
5972

73+
/**
74+
* Ensure that a proper exception is thrown for methods that do not exist
75+
* @param string $method
76+
* @param array $parameters
77+
* @throws \Unicodeveloper\Emoji\Exceptions\UnknownMethod
78+
*/
6079
public function __call($method, $parameters)
6180
{
6281
if (! method_exists(new static, $method)) {

0 commit comments

Comments
 (0)