File tree 2 files changed +15
-2
lines changed 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
namespace Unicodeveloper \Emoji ;
4
4
5
- use Unicodeveloper \Emoji \Exceptions \UnknownMethod ;
5
+ use Unicodeveloper \Emoji \Exceptions \{ UnknownMethod , UnknownEmoji } ;
6
6
7
7
class Emoji {
8
8
@@ -31,7 +31,7 @@ public function findByAlias($emojiName = null)
31
31
$ emoji = strtolower ($ emojiName );
32
32
33
33
if (! array_key_exists ($ emoji , $ this ->getEmojis ())) {
34
- throw new \ Exception ( " Emoji Not Found, Man. Check your spelling and try again " );
34
+ throw UnknownEmoji:: create ( $ emoji );
35
35
}
36
36
37
37
return $ this ->getEmojis ()[$ emoji ];
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Unicodeveloper \Emoji \Exceptions ;
4
+
5
+ use Exception ;
6
+
7
+ class UnknownEmoji extends Exception
8
+ {
9
+ public static function create ($ emoji ) : UnknownEmoji
10
+ {
11
+ return new static ("Emoji {$ emoji } Not Found, Man. Check your spelling and try again " );
12
+ }
13
+ }
You can’t perform that action at this time.
0 commit comments