/** * @param string $title * @param string $text * @param array $properties */ public function __construct($title, $text, $identifier = null, array $properties = null) { if (!is_scalar($title) && !is_scalar($text)) { throw new \InvalidArgumentException(sprintf("'title' and 'text' must be a scalar")); } parent::__construct(json_encode(['title' => $title, 'text' => $text, 'identifier' => $identifier]), $properties); }
/** * @param string $text * @param array $properties */ public function __construct($text, array $properties = null) { if (!is_scalar($text)) { throw new \InvalidArgumentException(sprintf("'text' must be of a scalar")); } parent::__construct($text, $properties); }
/** * @param string $value * @param array $properties */ public function __construct($value, array $properties = null) { if (!is_string($value)) { throw new \InvalidArgumentException(sprintf("The passed value must be of type string")); } parent::__construct($value, $properties); }
/** * @param float $value * @param array $properties */ public function __construct($value, array $properties = null) { if (!is_numeric($value)) { throw new \InvalidArgumentException("Value needs to be numeric"); } parent::__construct(floatval($value), $properties); }