Пример #1
0
 public function __construct($node, $parent)
 {
     parent::__construct($node, $parent);
     self::$possible_attributes = array_merge(parent::$possible_attributes, self::$possible_attributes);
     self::$required_attributes = array_merge(parent::$required_attributes, self::$required_attributes);
     self::$possible_children = array_merge(parent::$possible_children, self::$possible_children);
     self::$required_children = array_merge(parent::$required_children, self::$required_children);
 }
Пример #2
0
 /**
  * Get the emoji name by passing the unicode value
  * @param  string $unicode
  * @return string
  * @throws \Unicodeveloper\Emoji\Exceptions\IsNull
  * @throws \Unicodeveloper\Emoji\Exceptions\UnknownUnicode
  */
 public function findByUnicode($unicode = null) : string
 {
     if (is_null($unicode)) {
         throw IsNull::create("Please provide a valid UTF-8 Unicode value");
     }
     $emojis = array_flip($this->getEmojis());
     if (!array_key_exists($unicode, $emojis)) {
         throw UnknownUnicode::create($unicode);
     }
     return $emojis[$unicode];
 }