Set the value in the event.

@param ModelToLabelEvent $event     The event being emitted.
@param array             $arguments The label arguments.

@return void
437082
private function updateTableMode(ModelToLabelEvent $event, array $arguments)
    {
        if ((null === $arguments)
            || empty($arguments)
        ) {
            return;
        }

        $updateArguments = $event->getArgs();

        // Step 1 update arguments by index as propertyName
        foreach ($event->getFormatter()->getPropertyNames() as $index => $propertyName) {
            if (!isset($arguments[$propertyName])) {
                continue;
            }

            $updateArguments[$propertyName] = $arguments[$propertyName];
        }

        // Step 2 update arguments by index as integer
        foreach ($event->getFormatter()->getPropertyNames() as $index => $propertyName) {
            if (!isset($arguments[$index])) {
                continue;
            }

            $updateArguments[$propertyName] = $arguments[$index];
        }

        $event->setArgs($updateArguments);
    }
392337
public function triggerEvent($event, $args = [])
    {
        $dispatcher = $this->getDispatcher();

        if (!$dispatcher instanceof DispatcherInterface) {
            return null;
        }

        $args['mapper'] = $this;

        $event = $this->dispatcher->triggerEvent($event, $args);

        $innerListener = [$this, $event->getName()];

        if (!$event->isStopped() && method_exists($this, $event->getName())) {
            call_user_func($innerListener, $event);
        }

        return $event;
    }
287901
public function invokeCallbacks($event, $arg)
    {
        $this->checkEventType($event);
        foreach ($this->events[$event] as $callback) {
            call_user_func($callback, $arg);
        }
    }
1015587
public function setArguments($arguments = [])
    {
        $this->arguments = [];
        $this->requiredCount = 0;
        $this->hasOptional = false;
        $this->hasAnArrayArgument = false;
        $this->addArguments($arguments);
    }
328945
public function handle($event, $args) {
		if (isset($this->callback[$event])) {
			$this->callback[$event](...$args);
		}
	}
1202375
public function fireReflected(string $event, array $arguments = null) {
        return $this->getEventManager()->fireReflected($event, $arguments);
    }
1166540
public function error($label, $arguments = [])
    {
        $log_message = 'Error code: ' . $label;
        if ($arguments) {
            $log_message .= ', arguments: ' . json_encode($arguments);
        }
        Log::info($log_message);

        if($this->isAjaxRequest()) {
            $error_object = [
                'id' => 'server',
                'code' => '500',
                'message' => $label,
                'arguments' => $arguments
            ];

            echo json_encode([
                'errors' => [$error_object],
            ]);
        } else {
            echo "<h2>Server error: {$label}</h2>";
        }

        exit;
    }
103666
protected function addArgumentsToFunctionDescriptor(array $arguments, FunctionDescriptor $functionDescriptor): void
    {
        foreach ($arguments as $argument) {
            $this->addArgumentDescriptorToFunction(
                $functionDescriptor,
                $this->createArgumentDescriptor($functionDescriptor, $argument)
            );
        }
    }
379266
private function value($value, string $label = ''): void
    {
        if (is_scalar($value)) {
            $this->scalar($value, $label);
        } elseif (is_array($value)) {
            $this->iterable($value, $label);
        } elseif (is_object($value)) {
            $this->object($value, $label);
        }
    }
1283813
public function onLabelDelete(ResourceEvent $event)
    {
        $labelIdList  = $event->getResourceIdList();
        $channels     = [];

        foreach ($labelIdList as $labelId) {
            $channels[] = 'label:' . $labelId;
        }

        $this->notifService->getBackend()->deleteChannels($channels, true);
    }
506072
protected function _proxyEvent($event, $args = array())
    {
        //Publish the event
        if (class_exists('Koowa')) {
            KObjectManager::getInstance()->getObject('event.publisher')->publishEvent($event, $args, JFactory::getApplication());
        }
    }
242589
protected static function registerModelEvent($event, $callback)
    {
        $event = self::makeModelEventName($event);

        event()->listen($event, $callback);
    }
347288
public function setListener($event, callable $listener)
    {
        if (!is_string($event) || empty($event)) {
            throw new \InvalidArgumentException('The event name is invalid');
        }

        $this->listeners[$event] = $listener;
    }
1219537
public function onQuickFormEvent($event, $arg, &$caller) {
        $this->setMoodleForm($caller);
        switch ($event) {
            case 'updateValue':
                // Constant values override both default and submitted ones
                // default values are overriden by submitted.
                $value = $this->_findValue($caller->_constantValues);
                if (null === $value) {
                    // If no boxes were checked, then there is no value in the array
                    // yet we don't want to display default value in this case.
                    if ($caller->isSubmitted()) {
                        $value = $this->_findValue($caller->_submitValues);
                    } else {
                        $value = $this->_findValue($caller->_defaultValues);
                    }
                }
                if (!is_array($value)) {
                    $customize = ($value !== false || !$this->has_customize_switch());
                    if ($this->_options['type'] === 'text') {
                        $elementvalue = $customize ? $value : $this->_options['defaultvalue'];
                    } else {
                        $elementvalue = $this->timestamp_to_date_array($customize ? $value : $this->_options['defaultvalue']);
                    }
                    $value = [
                        'customize' => $customize,
                        'value' => $elementvalue
                    ];
                }
                $this->setValue($value);
                break;
            case 'createElement':
                $rv = parent::onQuickFormEvent($event, $arg, $caller);
                if ($this->has_customize_switch()) {
                    if ($this->_options['type'] === 'text') {
                        $caller->disabledIf($arg[0] . '[value]', $arg[0] . '[customize]', 'notchecked');
                    } else if ($this->_options['type'] === 'date_selector') {
                        $caller->disabledIf($arg[0] . '[value][day]', $arg[0] . '[customize]', 'notchecked');
                        $caller->disabledIf($arg[0] . '[value][month]', $arg[0] . '[customize]', 'notchecked');
                        $caller->disabledIf($arg[0] . '[value][year]', $arg[0] . '[customize]', 'notchecked');
                    } else {
                        // Date / Time selector.
                        $caller->disabledIf($arg[0] . '[value][day]', $arg[0] . '[customize]', 'notchecked');
                        $caller->disabledIf($arg[0] . '[value][month]', $arg[0] . '[customize]', 'notchecked');
                        $caller->disabledIf($arg[0] . '[value][year]', $arg[0] . '[customize]', 'notchecked');
                        $caller->disabledIf($arg[0] . '[value][hour]', $arg[0] . '[customize]', 'notchecked');
                        $caller->disabledIf($arg[0] . '[value][minute]', $arg[0] . '[customize]', 'notchecked');
                    }
                }
                return $rv;
            case 'addElement':
                $this->_usedcreateelement = false;
                return parent::onQuickFormEvent($event, $arg, $caller);
                break;
            default:
                return parent::onQuickFormEvent($event, $arg, $caller);
        }
    }
716364
private function object($object, string $label = ''): void
    {
        if ($object instanceof PresentationModel) {
            $this->presentationModel($object, $label);
        } elseif ($object instanceof View) {
            $this->view($object);
        } else {
            $this->iterable(get_object_vars($object), $label);
        }
    }
1171883
public static function orm_notify(Model $instance, $event)
	{
		if (method_exists($instance, $method = '_event_'.$event))
		{
			call_user_func(array($instance, $method));
		}
	}
630145
public function setLabel($label)
    {
        if (Format::isString256($label) === true) {
            $this->label = $label;
        } else {
            $msg = "The label argument must be a string with at most 256 characters.";
            throw new InvalidArgumentException($msg);
        }
    }