@param string $category

@return $this
@throws \LogicException when category is not of type "string"
971918
public function addCategory($category)
	{
		if (!is_string($category))
		{
			// @codeCoverageIgnoreStart
			throw new \LogicException('Category must be of a type "string"');
			// @codeCoverageIgnoreEnd
		}
		$this->categories[$category] = $category;

		return $this;
	}
1276308
public function setCategory($category)
    {
        $allowedValues = $this->getCategoryAllowableValues();
        if (!in_array($category, $allowedValues)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'category', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['category'] = $category;

        return $this;
    }
418992
public function setModules(string $category, array $classes): self {
        if ($this->areValidModules($category, $classes)) {
            $this->modules[$category] = $classes;
        }

        return $this;
    }
221949
public function removeCategory(\Enhavo\Bundle\CategoryBundle\Entity\Category $category)
    {
        $category->setCollection(null);
        $this->categories->removeElement($category);
    }
541577
public function find(int $id): CategoryInterface
    {
        $response = $this->shopware()->get('/api/categories/'.(string)$id);

        $categoryWrapper = $this->deserializer()
                                ->deserialize((string)$response->getBody());

        $category = $categoryWrapper->getData();
        if ( ! $category instanceof CategoryInterface) {
            throw new \LogicException();
        }

        return $category;
    }
368617
public function setAllowedCategories($categories)
    {
        if (is_string($categories)) {
            $categories = preg_split('/\s*,\s*/', $categories);
        }
        $this->allowedCategories = (array)$categories;
        return $this;
    }
1036888
public function removeCategory(\CsnCms\Entity\Category $category)
    {
        $this->categories->removeElement($category);
        $category->removeArticle($this); // update the other site

        return $this;
    }
1061974
public static function getInstance($category = self::CATEGORY_DEFAULT)
    {
        if (!isset(self::$instances[$category])) {
            self::$instances[$category] = new static($category);
        }
        return self::$instances[$category];
    }
369132
public function update(DocumentCategory $category)
    {
        $attributes = request()->validate(DocumentCategory::$rules, DocumentCategory::$messages);

        $category = $this->updateEntry($category, $attributes);

        return redirect_to_resource();
    }
278083
public function setCategory($category)
    {
        $allowed_values = array('alliance', 'character', 'constellation', 'corporation', 'inventory_type', 'region', 'solar_system', 'station');
        if ((!in_array($category, $allowed_values))) {
            throw new \InvalidArgumentException("Invalid value for 'category', must be one of 'alliance', 'character', 'constellation', 'corporation', 'inventory_type', 'region', 'solar_system', 'station'");
        }
        $this->container['category'] = $category;

        return $this;
    }
556406
public function addCategory($category)
    {
        if ( ! in_array($category, (array)$this->categories)) {
            $this->categories[] = $category;
        }

        return $this;
    }
653207
public function addCategory(\Enhavo\Bundle\CategoryBundle\Entity\Category $category)
    {
        $category->setCollection($this);
        $this->categories[] = $category;

        return $this;
    }
256876
private function unserializeProductPositions(\Magento\Catalog\Model\Category $category)
    {
        $productPositions = $category->getSortedProducts() ? $category->getSortedProducts() : [];

        if (is_string($productPositions)) {
            try {
                $productPositions = $this->jsonHelper->jsonDecode($productPositions);
            } catch (\Exception $e) {
                $productPositions = [];
            }
        }

        $category->setSortedProducts($productPositions);

        return $this;
    }
241992
public function removeCategory(CategoryInterface $category)
    {
        if ($this->hasCategory($category)) {
            $this->categories->removeElement($category);
        }

        return $this;
    }
107754
public function addCategory(array $category)
    {
        if (empty($category['term'])) {
            /**
             * @see Zend_Feed_Builder_Exception
             */
            require_once 'Zend/Feed/Builder/Exception.php';
            throw new Zend_Feed_Builder_Exception("you have to define the name of the category");
        }

        if (!$this->offsetExists('category')) {
            $categories = array($category);
        } else {
            $categories = $this->offsetGet('category');
            $categories[] = $category;
        }
        $this->offsetSet('category', $categories);
        return $this;
    }
146629
protected function prepareMetadata(array $category)
    {

        // initialize the metadata
        $metadata = array();

        // query whether or not, the passed category IS the root category
        if ($this->isRootCategory($category)) {
            return;
        }

        // if not, set the category ID in the metadata
        $metadata[UrlRewriteObserver::CATEGORY_ID] = (integer) $category[MemberNames::ENTITY_ID];

        // return the metadata
        return $metadata;
    }
87340
public function setCategory(\HarvestCloud\CoreBundle\Entity\Category $category)
    {
        $this->category = $category;

        return $this;
    }