예제 #1
0
 /**
  * @method null|string set(string $key, string $text)
  * @method null|string set(int $userId, string $key, string $lang, string $text)
  * @return $this
  */
 public function set()
 {
     $n = func_num_args();
     if ($n === 2) {
         $key = func_get_arg(0);
         $text = func_get_arg(1);
         $userId = $this->userId;
         $lang = $this->lang;
     } elseif ($n === 4) {
         $userId = func_get_arg(0);
         $key = func_get_arg(1);
         $lang = func_get_arg(2);
         $text = func_get_arg(3);
     } else {
         throw new \InvalidArgumentException('Wrong arguments: ' . implode(', ', func_get_args()));
     }
     $this->validateHostUid($userId);
     $this->dataProvider->setText($userId, $key, $lang, $text);
     return $this;
 }