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 , UnknownEmoji };
5
+ use Unicodeveloper \Emoji \Exceptions \{ UnknownMethod , UnknownEmoji , UnknownUnicode };
6
6
7
7
class Emoji {
8
8
@@ -51,7 +51,7 @@ public function findByUnicode($unicode = null)
51
51
$ emojis = array_flip ($ this ->getEmojis ());
52
52
53
53
if (! array_key_exists ($ unicode , $ emojis )) {
54
- throw new \ Exception ( " Emoji Not Found, Man. Please provide a valid UTF-8 Unicode value " );
54
+ throw UnknownUnicode:: create ( $ unicode );
55
55
}
56
56
57
57
return $ emojis [$ unicode ];
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 UnknownUnicode extends Exception
8
+ {
9
+ public static function create ($ unicode ) : UnknownUnicode
10
+ {
11
+ return new static ("Unicode {$ unicode } Not Found, Man. Please provide a valid UTF-8 Unicode value " );
12
+ }
13
+ }
You can’t perform that action at this time.
0 commit comments