メッセージを追加する

@param   string  $message
@param   int $icon

@return  $this

@throws  \InvalidArgumentException
544720
public function addMessage(string $message, int $icon = Template::ICON_NULL){
        $this->messages[]   = [
            "icon"      => Template::getIconName($icon),
            "message"   => trim($message),
        ];

        return $this;
    }
637446
public function setIcon(?string $icon): self
    {
        if (null === $icon) {
            $this->icon = $this->iconType = null;

            return $this;
        }

        if (':' === \mb_substr($icon, 0, 1) && ':' === \mb_substr($icon, \mb_strlen($icon) - 1, 1)) {
            $this->iconType = self::ICON_TYPE_EMOJI;
        } else {
            $this->iconType = self::ICON_TYPE_URL;
        }

        $this->icon = $icon;

        return $this;
    }
512082
public function setIcon($icon)
    {
        if ($icon[0] != '<') {
            $icon = '<i class="icon-'.$icon.'"></i>';
        }
        $this->template->trySetHTML('icon', $icon);

        return $this;
    }
399642
public function addIconMetric(string $name, $icon){
        if(!array_key_exists($icon, self::ICON_NAMES)){
            throw new \InvalidArgumentException();
        }

        $this->addMetric(
            trim($name),
            self::TYPE_ICON,
            [
                "icon"  => $icon,
            ]
        );
    }
673485
public function add($message, $scope = 'default')
    {
        $key = md5($scope.'~'.$message);
        $item = ['message' => $message, 'scope' => $scope];

        // don't add duplicates
        if (!array_key_exists($key, $this->messages)) {
            $this->messages[$key] = $item;
        }

        return $this;
    }
517475
public function setMessage($type, $message)
    {
        if (!is_null($message)) {
            $this->messages[] = [
                'message' => $message,
                'type'    => $type,
            ];
        }

        return $this;
    }
55259
public function setMessage(\Sopinet\ChatBundle\Entity\Message $message = null)
    {
        $this->message = $message;

        return $this;
    }
761400
public function addMessage($message) {
        $migrationName = get_class($this);
        $this->messages[] = sprintf("%s:  %s\n", $migrationName, $message);
    }
700400
public function addMessage($message) {
        if (!is_array(self::$_store->messages)) {
            self::$_store->messages = array();
        }
        $messages = self::$_store->messages;
        // Duplicates are wack
        if (in_array($message, $messages)) {
            return $this;
        }
        $messages[] = $message;
        self::$_store->messages = $messages;
        return $this;
    }
427118
protected function addNotification($message)
    {
        $event = new NotificationEvent();
        $event->setMessage($message);
        
        $this
            ->eventDispatcher
            ->dispatch(NotificationEvent::NAME, $event)
        ;
    }
178665
public function icon($icon, $icon2 = null)
    {
        $this->icon = trim($icon);

        if (! str_empty($icon2)) {
            $this->icon2 = trim($icon2);
        }

        return $this;
    }
1015239
public function setMessage($message)
    {
        $messageVariables = null;

        if (is_array($message)) {
            if (array_key_exists('messageVariables', $message)) {
                $messageVariables = $message['messageVariables'];
            }

            if (array_key_exists('message', $message)) {
                $message = $message['message'];
            } else {
                $messageVariables = $message;
                $message          = $this->messageTemplate;
            }
        }

        if (!is_string($message)) {
            throw new InvalidArgumentException(
                sprintf(
                    'Wrong parameters for %s([array|string $message]); %s given.',
                    __METHOD__,
                    is_object($message) ? get_class($message) : gettype($message)
                ),
                E_ERROR
            );
        }

        $this->message = $this->createMessage($message, $messageVariables);

        return $this;
    }
450274
public function thenInvalid($message)
    {
        $this->thenPart = function ($v) use ($message) { throw new \InvalidArgumentException(sprintf($message, json_encode($v))); };

        return $this;
    }
862267
function addMessage($rule, $message, $element = null) {
        $this->messages[$rule . ($element ? '.' . $element : '')] = $message;

        return $this;
    }
1186054
public function setIcon($icon)
    {
        $this->icon = $icon;

        $type = mb_substr($icon, 0, 1) === ':' && mb_substr($icon, -1) === ':'
            ? 'iconEmoji'
            : 'iconUrl';

        $this->$type = $icon;

        return $this;
    }
1251056
public function addTransientMessage($message, $options = null) {
		$options = $this->_mergeOptions($options);
		$options['message'] = $message;

		$messages = (array)Configure::read('TransientFlash.' . $options['key']);
		if ($messages && count($messages) > $this->getConfig('limit')) {
			array_shift($messages);
		}
		$messages[] = $options;
		Configure::write('TransientFlash.' . $options['key'], $messages);
	}
488773
public static function invalidArgument($message = null)
    {
        $defaultMessage = sprintf('Invalid argument passed in GameParameters.');
        $message = null === $message ? $defaultMessage : $message;

        return new static($message);
    }