How to use growl class

Best Atoum code snippet using growl

Application.php

Source:Application.php Github

copy

Full Screen

...37 * @author Laurent Laville <pear@laurent-laville.org>38 * @author Bertrand Mansion <bmansion@mamasam.com>39 * @license http://www.opensource.org/licenses/bsd-license.php BSD40 * @version SVN: $Id: Application.php 324805 2012-04-04 16:05:33Z farell $41 * @link http://growl.laurent-laville.org/42 * @link http://pear.php.net/package/Net_Growl43 * @since File available since Release 0.9.044 */45 46/**47 * Application object for {@link Net_Growl}48 *49 * This object represents an application containing the notifications50 * to be registered by {@link http://growl.info Growl}. Feel free to use51 * your own application object as long as it implements the few public52 * getter methods:53 * - {@link Net_Growl_Application::getGrowlNotifications()}54 * - {@link Net_Growl_Application::getGrowlIcon()}55 * - {@link Net_Growl_Application::getGrowlName()}56 * - {@link Net_Growl_Application::getGrowlPassword()}57 * setter methods58 * - {@link Net_Growl_Application::addGrowlNotifications()}59 * - {@link Net_Growl_Application::setGrowlIcon()}60 * - {@link Net_Growl_Application::setGrowlName()}61 * - {@link Net_Growl_Application::setGrowlPassword()}62 *63 * @category Networking64 * @package Net_Growl65 * @author Laurent Laville <pear@laurent-laville.org>66 * @author Bertrand Mansion <bmansion@mamasam.com>67 * @license http://www.opensource.org/licenses/bsd-license.php BSD68 * @version Release: 2.6.069 * @link http://growl.laurent-laville.org/70 * @link http://pear.php.net/package/Net_Growl71 * @since Class available since Release 0.9.072 */73class Net_Growl_Application74{75 /**76 * Name of application to be registered by Growl77 * @var string78 */79 private $_growlAppName;80 /**81 * Password for notifications82 * @var string83 */84 private $_growlAppPassword = '';85 /**86 * Name of application to be registered by Growl87 * @var string88 */89 private $_growlAppIcon = '';90 /**91 * Array of notifications92 * @var array93 */94 private $_growlNotifications = array();95 /**96 * Constructor97 * Constructs a new application to be registered by Growl98 *99 * @param string $appName (optional) Application name100 * @param array $notifications (optional) Array of notifications101 * @param string $password (optional) Password to be used to notify Growl102 * @param string $appIcon (optional) Application icon103 *104 * @return void105 * @throws InvalidArgumentException106 * @see addGrowlNotifications()107 * @see setGrowlName(), setGrowlPassword(), setGrowlIcon()108 */109 public function __construct($appName = null, $notifications = null,110 $password = null, $appIcon = null111 ) {112 if (isset($appName)) {113 $this->setGrowlName($appName);114 }115 if (isset($password)) {116 $this->setGrowlPassword($password);117 }118 if (isset($appIcon)) {119 $this->setGrowlIcon($appIcon);120 }121 if (isset($notifications)) {122 $this->addGrowlNotifications($notifications);123 }124 }125 /**126 * Adds notifications supported by this application127 *128 * Expected array format is:129 * <pre>130 * array('notification name' => array('option name' => 'option value'))131 * </pre>132 * At the moment, only option name 'enabled' is supported for UDP. Example:133 * <code>134 * $notifications = array('Test Notification' => array('enabled' => true));135 * </code>136 *137 * @param array $notifications Array of notifications to support138 *139 * @return void140 * @throws InvalidArgumentException141 */142 public function addGrowlNotifications($notifications)143 {144 if (!is_array($notifications)) {145 throw new InvalidArgumentException;146 }147 $default = array('enabled' => true);148 foreach ($notifications as $name => $options) {149 if (is_int($name)) {150 $name = $options;151 $options = $default;152 } elseif (is_array($options)) {153 $options = array_merge($default, $options);154 }155 $this->_growlNotifications[$name] = $options;156 }157 }158 /**159 * Returns the notifications accepted by Growl for this application160 *161 * Expected array format is:162 * <pre>163 * array('notification name' => array('option name' => 'option value'))164 * </pre>165 * At the moment, only option name 'enabled' is supported. Example:166 * <code>167 * $notifications = array('Test Notification' => array('enabled' => true));168 * return $notifications;169 * </code>170 *171 * @return array notifications172 */173 public function getGrowlNotifications()174 {175 return $this->_growlNotifications;176 }177 /**178 * Sets the application name for registration in Growl179 *180 * @param string $appName Application name181 *182 * @return void183 * @throws InvalidArgumentException184 * @see getGrowlName()185 */186 public function setGrowlName($appName)187 {188 if (!is_string($appName)) {189 throw new InvalidArgumentException;190 }191 $this->_growlAppName = $appName;192 }193 /**194 * Returns the application name for registration in Growl195 *196 * @return string application name197 * @see setGrowlName()198 */199 public function getGrowlName()200 {201 return $this->_growlAppName;202 }203 /**204 * Sets the password to be used by Growl to accept notification packets205 *206 * @param string $password Password to be used to notify Growl207 *208 * @return void209 * @throws InvalidArgumentException210 * @see getGrowlPassword()211 */212 public function setGrowlPassword($password)213 {214 if (!is_string($password)) {215 throw new InvalidArgumentException;216 }217 $this->_growlAppPassword = $password;218 }219 /**220 * Returns the password to be used by Growl to accept notification packets221 *222 * @return string password223 * @see setGrowlPassword()224 */225 public function getGrowlPassword()226 {227 return $this->_growlAppPassword;228 }229 /**230 * Sets the application icon for registration in Growl231 *232 * @param string $appIcon Application icon233 *234 * @return void235 * @throws InvalidArgumentException236 * @see getGrowlIcon()237 */238 public function setGrowlIcon($appIcon)239 {240 if (!is_string($appIcon)) {241 throw new InvalidArgumentException;242 }243 $this->_growlAppIcon = $appIcon;244 }245 /**246 * Returns the application icon for registration in Growl247 *248 * @return string application icon (valid url) or empty if default image249 * @see setGrowlIcon()250 */251 public function getGrowlIcon()252 {253 return $this->_growlAppIcon;254 }255}256 ...

Full Screen

Full Screen

Udp.php

Source:Udp.php Github

copy

Full Screen

...37 * @author Laurent Laville <pear@laurent-laville.org>38 * @author Bertrand Mansion <bmansion@mamasam.com>39 * @license http://www.opensource.org/licenses/bsd-license.php BSD40 * @version SVN: $Id: Udp.php 324805 2012-04-04 16:05:33Z farell $41 * @link http://growl.laurent-laville.org/42 * @link http://pear.php.net/package/Net_Growl43 * @since File available since Release 0.9.044 */45 46/**47 * Growl implements UDP protocol48 *49 * @category Networking50 * @package Net_Growl51 * @author Laurent Laville <pear@laurent-laville.org>52 * @author Bertrand Mansion <bmansion@mamasam.com>53 * @license http://www.opensource.org/licenses/bsd-license.php BSD54 * @version Release: 2.6.055 * @link http://growl.laurent-laville.org/56 * @link http://pear.php.net/package/Net_Growl57 * @link http://growl.info Growl Homepage58 * @since Class available since Release 0.9.059 */60class Net_Growl_Udp extends Net_Growl61{62 /**63 * Class constructor64 *65 * @param mixed &$application Can be either a Net_Growl_Application object66 * or the application name string67 * @param array $notifications List of notification types68 * @param string $password (optional) Password for Growl69 * @param array $options (optional) List of options : 'host', 'port',70 * 'protocol', 'timeout' for Growl socket server.71 * 'debug' to know what data are sent and received.72 */73 public function __construct(&$application, $notifications = array(),74 $password = '', $options = array()75 ) {76 parent::__construct($application, $notifications, $password, $options);77 }78 /**79 * Sends the REGISTER message type80 *81 * @return true82 * @throws Net_Growl_Exception if remote server communication failure83 */84 public function sendRegister()85 {86 $appName = $this->utf8Encode($this->getApplication()->getGrowlName());87 $password = $this->getApplication()->getGrowlPassword();88 $nameEnc = $defaultEnc = '';89 $nameCnt = $defaultCnt = 0;90 $notifications = $this->getApplication()->getGrowlNotifications();91 foreach ($notifications as $name => $options) {92 if (is_array($options) && !empty($options['enabled'])) {93 $defaultEnc .= pack('c', $nameCnt);94 $defaultCnt++;95 }96 $name = $this->utf8Encode($name);97 $nameEnc .= pack('n', $this->strByteLen($name)).$name;98 $nameCnt++;99 }100 // Version of the Growl protocol used in this package101 $_growl_protocol_version = 1;102 // Packet of type Registration103 $_growl_type_registration = 0;104 $data = pack(105 'c2nc2',106 $_growl_protocol_version,107 $_growl_type_registration,108 $this->strByteLen($appName),109 $nameCnt,110 $defaultCnt111 );112 $data .= $appName . $nameEnc . $defaultEnc;113 $data .= pack('H32', md5($data . $password));114 return $this->sendRequest('REGISTER', $data);115 }116 /**117 * Sends the NOTIFY message type118 *119 * @param string $name Notification name120 * @param string $title Notification title121 * @param string $description Notification description122 * @param string $options Notification options123 *124 * @return true125 * @throws Net_Growl_Exception if remote server communication failure126 */127 public function sendNotify($name, $title, $description, $options)128 {129 $appName = $this->utf8Encode($this->getApplication()->getGrowlName());130 $password = $this->getApplication()->getGrowlPassword();131 $name = $this->utf8Encode($name);132 $title = $this->utf8Encode($title);133 $description = $this->utf8Encode($description);134 $priority = isset($options['priority'])135 ? $options['priority'] : Net_Growl::PRIORITY_NORMAL;136 $flags = ($priority & 7) * 2;137 if ($priority < 0) {138 $flags |= 8;139 }140 if (isset($options['sticky']) && $options['sticky'] === true) {141 $flags = $flags | 1;142 }143 // Version of the Growl protocol used in this package144 $_growl_protocol_version = 1;145 // Packet of type Notification146 $_growl_type_notification = 1;147 $data = pack(148 'c2n5',149 $_growl_protocol_version,150 $_growl_type_notification,151 $flags,152 $this->strByteLen($name),153 $this->strByteLen($title),154 $this->strByteLen($description),155 $this->strByteLen($appName)156 );157 $data .= $name . $title . $description . $appName;158 $data .= pack('H32', md5($data . $password));159 return $this->sendRequest('NOTIFY', $data);160 }161}162 ...

Full Screen

Full Screen

AlertBlock.php

Source:AlertBlock.php Github

copy

Full Screen

...9use Yii;10use yii\helpers\Html;11use yii\helpers\ArrayHelper;12use kartik\base\Config;13use kartik\growl\Growl;14/**15 * Alert block widget that groups multiple `\kartik\widget\Alert` or `kartik\widget\Growl` widgets as one single block.16 * You can choose to automatically read and display session flash messages (which is the default setting) or setup17 * your own block of custom alerts.18 *19 * @author Kartik Visweswaran <kartikv2@gmail.com>20 * @since 1.021 */22class AlertBlock extends \yii\bootstrap\Widget23{24 const TYPE_ALERT = 'alert';25 const TYPE_GROWL = 'growl';26 /**27 * @var string the type of alert to use. Can be one of `TYPE_ALERT` or `TYPE_GROWL`.28 * Defaults to `TYPE_ALERT`.29 */30 public $type = self::TYPE_ALERT;31 /**32 * @var integer time in milliseconds to delay the fade out of each alert. If set to `0` or `false`, alerts33 * will never fade out and will be always displayed. This defaults to `2000` ms for `TYPE_ALERT` and34 * `1000` ms for `TYPE_GROWL`.35 */36 public $delay;37 /**38 * @var bool whether to automatically use messages set via `Yii::$app->session->setFlash()`. Defaults to `true`.39 * If set to `false`, you would need to pass the `body` setting within `alertSetting` array.40 */41 public $useSessionFlash = true;42 /**43 * @var array the alert types configuration for the alert messages. This array is setup as $alert => $settings, where:44 * - $alert: string is the name of the session flash variable (e.g. error, success, info, warning)45 * - $settings: array, the `\kartik\widgets\Alert` or `\kartik\widgets\Growl` widget settings depending46 * on what `type` has been set.47 * @see \kartik\widgets\Alert48 * @see \kartik\widgets\Growl49 */50 public $alertSettings = [];51 /**52 * @var array the options for rendering the close button tag. This will be overridden by the `closeButton` setting53 * within the `alertSettings` configuration.54 */55 public $closeButton = [];56 /**57 * Initialize the alert block widget58 */59 public function init()60 {61 parent::init();62 $this->initOptions();63 echo Html::beginTag('div', $this->options) . "\n";64 }65 /**66 * Runs the widget67 */68 public function run()69 {70 parent::run();71 if ($this->useSessionFlash) {72 $this->renderFlashAlerts();73 } else {74 $this->renderAlerts();75 }76 echo "\n" . Html::endTag('div');77 }78 /**79 * Initializes options and settings80 * @throws InvalidConfigException81 */82 protected function initOptions()83 {84 if ($this->type == self::TYPE_GROWL) {85 Config::checkDependency('growl\Growl', 'yii2-widget-growl', 'for rendering Growl notifications in the alert block');86 }87 if (empty($this->options['id'])) {88 $this->options['id'] = $this->getId();89 }90 if (!isset($this->delay)) {91 $this->delay = ($this->type == self::TYPE_ALERT) ? 2000 : 1200;92 }93 if (empty($this->alertSettings) && $this->type == self::TYPE_GROWL) {94 $this->alertSettings = [95 'error' => ['type' => Growl::TYPE_DANGER],96 'success' => ['type' => Growl::TYPE_SUCCESS],97 'info' => ['type' => Growl::TYPE_INFO],98 'warning' => ['type' => Growl::TYPE_WARNING],99 'growl' => ['type' => Growl::TYPE_GROWL]100 ];101 } elseif (empty($this->alertSettings)) {102 $this->alertSettings = [103 'error' => ['type' => Alert::TYPE_DANGER],104 'success' => ['type' => Alert::TYPE_SUCCESS],105 'info' => ['type' => Alert::TYPE_INFO],106 'warning' => ['type' => Alert::TYPE_WARNING],107 'primary' => ['type' => Alert::TYPE_PRIMARY],108 'default' => ['type' => Alert::TYPE_DEFAULT]109 ];110 }111 }112 /**113 * Renders alerts from session flash...

Full Screen

Full Screen

growl

Using AI Code Generation

copy

Full Screen

1$growl = new \atoum\atoum\reports\realtime\growl();2$runner->addReport($growl);3$growl = new \atoum\atoum\reports\realtime\growl();4$runner->addReport($growl);5$growl = new \atoum\atoum\reports\realtime\growl();6$runner->addReport($growl);7$growl = new \atoum\atoum\reports\realtime\growl();8$runner->addReport($growl);9$growl = new \atoum\atoum\reports\realtime\growl();10$runner->addReport($growl);11$growl = new \atoum\atoum\reports\realtime\growl();12$runner->addReport($growl);13$growl = new \atoum\atoum\reports\realtime\growl();14$runner->addReport($growl);15$growl = new \atoum\atoum\reports\realtime\growl();16$runner->addReport($growl);17$growl = new \atoum\atoum\reports\realtime\growl();18$runner->addReport($growl);19$growl = new \atoum\atoum\reports\realtime\growl();20$runner->addReport($growl);21$growl = new \atoum\atoum\reports\realtime\growl();22$runner->addReport($growl);23$growl = new \atoum\atoum\reports\realtime\growl();

Full Screen

Full Screen

growl

Using AI Code Generation

copy

Full Screen

1require_once 'atoum/growl.php';2$growl = new atoum\growl();3$growl->notify('test');4require_once 'atoum/growl.php';5$growl = new atoum\growl();6$growl->notify('test');7require_once 'atoum/growl.php';8$growl = new atoum\growl();9$growl->notify('test');10require_once 'atoum/growl.php';11$growl = new atoum\growl();12$growl->notify('test');13require_once 'atoum/growl.php';14$growl = new atoum\growl();15$growl->notify('test');16require_once 'atoum/growl.php';17$growl = new atoum\growl();18$growl->notify('test');19require_once 'atoum/growl.php';20$growl = new atoum\growl();21$growl->notify('test');22require_once 'atoum/growl.php';23$growl = new atoum\growl();24$growl->notify('test');25require_once 'atoum/growl.php';26$growl = new atoum\growl();27$growl->notify('test');28require_once 'atoum/growl.php';29$growl = new atoum\growl();30$growl->notify('test');

Full Screen

Full Screen

growl

Using AI Code Generation

copy

Full Screen

1require_once 'classes/Growl.php';2$growl = new Growl();3$growl->setApplication('My App');4$growl->setNotifications(array('Notification 1', 'Notification 2'));5$growl->register();6$growl->notify('Notification 1', 'Title', 'Message');7require_once 'classes/Growl.php';8$growl = new Growl();9$growl->setApplication('My App');10$growl->setNotifications(array('Notification 1', 'Notification 2'));11$growl->register();12$growl->notify('Notification 2', 'Title', 'Message');

Full Screen

Full Screen

growl

Using AI Code Generation

copy

Full Screen

1require_once 'atoum/classes/growl.php';2$growl = new growl();3$growl->send('Message Title', 'Message Body');4require_once 'atoum/classes/growl.php';5$growl = new growl();6$growl->send('Message Title', 'Message Body');7require_once 'atoum/classes/growl.php';8$growl = new growl();9$growl->send('Message Title', 'Message Body');10require_once 'atoum/classes/growl.php';11$growl = new growl();12$growl->send('Message Title', 'Message Body');13require_once 'atoum/classes/growl.php';14$growl = new growl();15$growl->send('Message Title', 'Message Body');16require_once 'atoum/classes/growl.php';17$growl = new growl();18$growl->send('Message Title', 'Message Body');19require_once 'atoum/classes/growl.php';20$growl = new growl();21$growl->send('Message Title', 'Message Body');22require_once 'atoum/classes/growl.php';23$growl = new growl();24$growl->send('Message Title', 'Message Body');25require_once 'atoum/classes/growl.php';26$growl = new growl();27$growl->send('Message Title', 'Message Body');

Full Screen

Full Screen

growl

Using AI Code Generation

copy

Full Screen

1include_once('growl.php');2$growl = new Growl('localhost', 'growlphp');3$growl->register(array('PHP','PHP errors','PHP warnings','PHP debug'));4$growl->notify('PHP','PHP','PHP message','test message from PHP');5include_once('growl.php');6$growl = new Growl('localhost', 'growlphp');7$growl->register(array('PHP','PHP errors','PHP warnings','PHP debug'));8$growl->notify('PHP','PHP errors','PHP error message','test error message from PHP');9include_once('growl.php');10$growl = new Growl('localhost', 'growlphp');11$growl->register(array('PHP','PHP errors','PHP warnings','PHP debug'));12$growl->notify('PHP','PHP warnings','PHP warning message','test warning message from PHP');13include_once('growl.php');14$growl = new Growl('localhost', 'growlphp');15$growl->register(array('PHP','PHP errors','PHP warnings','PHP debug'));16$growl->notify('PHP','PHP debug','PHP debug message','test debug message from PHP');

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Atoum automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Run Selenium Automation Tests on LambdaTest Cloud Grid

Trigger Selenium automation tests on a cloud-based Grid of 3000+ real browsers and operating systems.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful