public function addCategory($category)
    {
        if ($category instanceof FeedItemCategory) {
            $this->categories[] = $category;
        } elseif (is_array($category)) {
            if (!empty($category)) {
                $this->categories[] = FeedItemCategory::createFromArray($category);
            }
        } else {
            throw new \InvalidArgumentException('Invalid category');
        }

        return $this;
    }
public function addCategory($category)
    {
        if ($category instanceof FeedItemCategory) {
            $this->categories[] = $category;
        } elseif (is_array($category)) {
            if (!empty($category)) {
                $this->categories[] = FeedItemCategory::createFromArray($category);
            }
        } else {
            throw new \InvalidArgumentException('Invalid category');
        }

        return $this;
    }
public function addCategory ( $ category ) { if ( $ category instanceof FeedItemCategory ) { $ this -> categories [ ] = $ category ; } elseif ( is_array ( $ category ) ) { if ( ! empty ( $ category ) ) { $ this -> categories [ ] = FeedItemCategory :: createFromArray ( $ category ) ; } } else { throw new \ InvalidArgumentException ( 'Invalid category' ) ; } return $ this ; }
Adds category.

@param FeedItemCategory|array $category

@return Feed

@throws \InvalidArgumentException
Adds category .