Add a category to the tree.

@param category $cat category object.

@throws \coding_exception
358301
public function add_category(category $cat) {
        $name = $cat->name;
        if (isset($this->categories[$name])) {
            throw new \coding_exception("Category name $name already used");
        }
        $this->categories[$cat->name] = $cat;
    }
440308
public function addCategorie(\Haven\CoreBundle\Entity\Category $categories)
    {
        $this->categories[] = $categories;
    
        return $this;
    }
795977
public function make(ICategory $category)
    {
        //$category->setContent($this->view->make($category->getLayoutViewPath(), compact('category'))->render());
        $category->setContent($this->view->make(\OogleeBConfig::get('config.category_view.view'), compact('category'))->render());
    }
247922
public function setCategory(\Mvc\BlogBundle\Entity\Category $category)
    {
        $this->category = $category;

        return $this;
    }
1004442
protected function addCategoryGroup()
    {
        if (!$this->isError()) {
            $id = $this->category_group->add($this->getSubmitted());
            if (empty($id)) {
                $this->errorAndExit($this->text('Unexpected result'));
            }
            $this->line($id);
        }
    }
453473
protected function set_categories() {
		$categories = get_the_category( get_the_ID() );
		if ( $categories ) {
			$category = array_shift( $categories );
			$this->set_ancestors( $category->term_id, 'category' );
			$this->set( $category->name, get_term_link( $category ) );
		}
	}
559057
public function load(ICategory $category)
    {
        $this->template->set('title', $category->getTitle());
        $this->template->set('meta_title', $category->metaTitle());
        $this->template->set('meta_keywords', $category->metaKeywords());
        $this->template->set('meta_description', $category->metaDescription());
    }
903189
public function addCategory(\Hexmedia\ContentBundle\Entity\Category $category)
    {
        $this->categories[] = $category;

        return $this;
    }
1106098
public function addCategory(CategoryEntity $category)
    {
        $fileVersion = $this->getFileVersion();
        $fileVersion->addCategory($category);

        return $this;
    }
1132527
protected function ensure_category_loaded() {
        if (is_array($this->_categories)) {
            return; // Already done.
        }
        if (is_null($this->_course)) {
            throw new coding_exception('Attempt to get the course category for this page before the course was set.');
        }
        if ($this->_course->category == 0) {
            $this->_categories = array();
        } else {
            $this->load_category($this->_course->category);
        }
    }
1056780
public static function createFromCategory(Category $category): self
    {
        $message = new self();
        $message->setId($category->getId());
        $message->setEnabled($category->isEnabled());

        foreach ($category->getTranslations() as $translation) {
            $transMessage = CategoryTranslationMessage::createFromCategoryTranslation($translation);

            $message->addTranslation($transMessage);
        }

        return $message;
    }
866052
private void updateOmissionCategories(String[] cat) {
        short itens = this.omissionsCategoriesDropbox.getItemCount();
        if(itens > 0) {
            this.omissionsCategoriesDropbox.removeItems((short)0, itens);
        }
        this.omissionsCategoriesDropbox.addItem(I18nLabelsLoader.ADDON_OMISSION_CATEGORY_CUSTOM, (short)0);
        this.omissionsCategoriesDropbox.addItem(I18nLabelsLoader.ADDON_OMISSION_CATEGORY_UNKNOWN, (short)1);
        this.omissionsCategoriesDropbox.addItems(cat, (short)2);

    }
116637
public function createCategory($categoryKey)
    {
        $this->requireCategoryDoesNotExist($categoryKey);

        $this->validateName($categoryKey);

        $this->optionCategoryModel->create(['key' => $categoryKey]);
        $this->refresh();
        $this->options[$categoryKey] = [];
    }
461101
function () {
  var cats = getCategories();
  for (var i in cats) {
    log.debug('\n\nTEST CATEGORY: ' + cats[i]);
    testCategory(cats[i]);
  }
}
1317122
public function defineCategories($header)
	{
		$categories = array();
		$cats = explode(',', $header['categories']);
		foreach ($cats as $category) 
		{
			$categories[] = new Category(trim($category));
		}
		return $categories;
	}
351490
protected function updateCategory($category_id)
    {
        if (!$this->isError() && !$this->category->update($category_id, $this->getSubmitted())) {
            $this->errorAndExit($this->text('Unexpected result'));
        }
    }
199791
public function setCategory($category)
    {
        self::writeFullTag(
            $category,
            'category',
            true,
            'video:category',
            $this->validator,
            'validateCategory',
            $this->exception,
            'Provided category value is not a valid.'
        );

        return $this;
    }