AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 18.226.93.114
Web Server : Apache
System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
User : bitrix ( 600)
PHP Version : 8.1.27
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/bitrix/www/bitrix/modules/translate/lib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/bitrix/www/bitrix/modules/translate/lib/warning.php
<?php

namespace Bitrix\Translate;

use Bitrix\Main;

/**
 * Warning collection.
 */
trait Warning
{
	/** @var Main\ErrorCollection */
	protected $warningCollection;

	/**
	 * Adds warning to collection.
	 *
	 * @param Main\Error $error Error.
	 *
	 * @return $this
	 */
	final public function addWarning(Main\Error $error): self
	{
		if (!$this->warningCollection instanceof Main\ErrorCollection)
		{
			$this->warningCollection = new Main\ErrorCollection;
		}

		$this->warningCollection[] = $error;

		return $this;
	}

	/**
	 * Getting array of warnings.
	 *
	 * @return Main\Error[]
	 */
	final public function getWarnings(): array
	{
		if (!$this->warningCollection instanceof Main\ErrorCollection)
		{
			return array();
		}

		return $this->warningCollection->toArray();
	}

	/**
	 * Checks if warning occurred.
	 *
	 * @return boolean
	 */
	final public function hasWarnings(): bool
	{
		if (!$this->warningCollection instanceof Main\ErrorCollection)
		{
			return false;
		}

		return !$this->warningCollection->isEmpty();
	}

	/**
	 * Returns last warning from list.
	 *
	 * @return Main\Error|null
	 */
	final public function getLastWarning(): ?Main\Error
	{
		if (!$this->warningCollection instanceof Main\ErrorCollection)
		{
			return null;
		}
		if (!$this->hasWarnings())
		{
			return null;
		}

		$offset = $this->warningCollection->count() - 1;

		return $this->warningCollection->offsetGet($offset);
	}

	/**
	 * Returns first warning from list.
	 *
	 * @return Main\Error|null
	 */
	final public function getFirstWarning(): ?Main\Error
	{
		if (!$this->warningCollection instanceof Main\ErrorCollection)
		{
			return null;
		}
		if (!$this->hasWarnings())
		{
			return null;
		}

		return $this->warningCollection->offsetGet(0);
	}
}

Anon7 - 2022
AnonSec Team