• Модуль: seo
  • Путь к файлу: ~/bitrix/modules/seo/lib/analytics/internals/expenses.php
  • Класс: BitrixSeoAnalyticsInternalsExpenses
  • Вызов: Expenses::add
public function add(array $data)
{
	foreach($this->getNumericFieldNames() as $name)
	{
		if(isset($data[$name]))
		{
			$value = $data[$name];
			if (is_array($value))
			{
				$value = array_sum(array_map(
					function ($value)
					{
						return is_numeric($value) ? $value : 0;
					},
					array_column($value, 'value')
				));
			}
			if (is_numeric($value))
			{
				$this->data[$name] += $value;
			}
		}
	}
	if(isset($data['currency']) && empty($this->data['currency']))
	{
		$this->data['currency'] = $data['currency'];
	}

	return $this;
}