Your IP : 3.138.100.233


Current Path : /home/bitrix/ext_www/crm.klimatlend.ua/bitrix/modules/imbot/lib/itr/
Upload File :
Current File : /home/bitrix/ext_www/crm.klimatlend.ua/bitrix/modules/imbot/lib/itr/menu.php

<?php
namespace Bitrix\ImBot\Itr;

class Menu
{
	private $id = 0;
	private $text = '';
	private $items = Array();

	/**
	 * ItrMenu constructor.
	 * @param $id
	 */
	public function __construct($id)
	{
		$this->id = intval($id);
	}

	public function getId()
	{
		return $this->id;
	}

	public function getText()
	{
		return $this->text;
	}

	public function getItems()
	{
		return $this->items;
	}

	public function setText($text)
	{
		$this->text = trim($text);
	}

	public function addItem($id, $title, array $action)
	{
		$id = intval($id);
		if ($id <= 0 && !in_array($action['TYPE'], Array(Item::TYPE_VOID, Item::TYPE_TEXT)))
		{
			return false;
		}

		$title = trim($title);

		$this->items[$id] = Array(
			'ID' => $id,
			'TITLE' => $title,
			'ACTION' => $action
		);

		return true;
	}
}