示例#1
0
 /**
  * @param array $identity
  * @return $this
  * @throws \InvalidArgumentException
  */
 public function createIdentities(array $identity)
 {
     if (empty($identity)) {
         throw new \InvalidArgumentException('the parameter "$identity" must not be empty');
     }
     foreach ($identity as $username => $config) {
         $identObj = new Identity();
         $identObj->setUsername($username);
         $identObj->setIconEmoji(isset($config['icon_emoji']) ? $config['icon_emoji'] : null);
         $identObj->setIconUrl(isset($config['icon_url']) ? $config['icon_url'] : null);
         $this->add($identObj);
     }
     return $this;
 }