/** * @param CList|int $list * @return $this * @throws \InvalidArgumentException */ public function setList($list) { if (!$list instanceof CList) { if (!is_numeric($list) && !is_string($list)) { throw new \InvalidArgumentException(sprintf('%s expects a CList instance, string, or int, %s given', __METHOD__, is_object($list) ? get_class($list) : gettype($list))); } $list = new CList(array('stringId' => $list)); } if (!$list->getStringId() && $list->getId()) { $list->setStringId($list->getId()); } $this->list = $list; return $this; }