Whip_HostMessage

Class Whip_HostMessage.

Defined (1)

The class is defined in the following location(s).

/vendor/yoast/whip/src/messages/Whip_HostMessage.php  
  1. class Whip_HostMessage implements Whip_Message { 
  2.  
  3. /** 
  4. * @var string 
  5. */ 
  6. private $textdomain; 
  7.  
  8. /** 
  9. * @var string 
  10. */ 
  11. private $messageKey; 
  12.  
  13. /** 
  14. * @var string 
  15. */ 
  16. private $filterKey; 
  17.  
  18. /** 
  19. * Whip_Message constructor. 
  20. * @param string $messageKey The environment key to use to retrieve the message from. 
  21. * @param string $textdomain The text domain to use for translations. 
  22. */ 
  23. public function __construct( $messageKey, $textdomain ) { 
  24. $this->textdomain = $textdomain; 
  25. $this->messageKey = $messageKey; 
  26.  
  27. /** 
  28. * Renders the message body. 
  29. * @return string The message body. 
  30. */ 
  31. public function body() { 
  32. $message = array(); 
  33.  
  34. $message[] = Whip_MessageFormatter::strong( $this->title() ) . '<br />'; 
  35. $message[] = Whip_MessageFormatter::paragraph( Whip_Host::message( $this->messageKey, $this->filterKey ) ); 
  36.  
  37. return implode( $message, "\n" ); 
  38.  
  39. /** 
  40. * Renders the message title. 
  41. * @return string The message title. 
  42. */ 
  43. public function title() { 
  44. return sprintf( __( 'A message from %1$s', $this->textdomain ), Whip_Host::name() );