Source for file Application.php
Documentation is available at Application.php
* Copyright (c) 2009-2013, Laurent Laville <pear@laurent-laville.org>
* Bertrand Mansion <bmansion@mamasam.com>
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the authors nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* @author Laurent Laville <pear@laurent-laville.org>
* @author Bertrand Mansion <bmansion@mamasam.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD
* @version SVN: $Id: Application.php 329338 2013-01-29 14:21:39Z farell $
* @link http://growl.laurent-laville.org/
* @link http://pear.php.net/package/Net_Growl
* @since File available since Release 0.9.0
* Application object for {@link Net_Growl}
* This object represents an application containing the notifications
* to be registered by {@link http://growl.info Growl}. Feel free to use
* your own application object as long as it implements the few public
* - {@link Net_Growl_Application::getGrowlNotifications()}
* - {@link Net_Growl_Application::getGrowlIcon()}
* - {@link Net_Growl_Application::getGrowlName()}
* - {@link Net_Growl_Application::getGrowlPassword()}
* - {@link Net_Growl_Application::addGrowlNotifications()}
* - {@link Net_Growl_Application::setGrowlIcon()}
* - {@link Net_Growl_Application::setGrowlName()}
* - {@link Net_Growl_Application::setGrowlPassword()}
* @author Laurent Laville <pear@laurent-laville.org>
* @author Bertrand Mansion <bmansion@mamasam.com>
* @license http://www.opensource.org/licenses/bsd-license.php BSD
* @version Release: 2.7.0
* @link http://growl.laurent-laville.org/
* @link http://pear.php.net/package/Net_Growl
* @since Class available since Release 0.9.0
* Name of application to be registered by Growl
* Password for notifications
private $_growlAppPassword = '';
* Icon of application to be registered by Growl
private $_growlAppIcon = '';
private $_growlNotifications = array ();
* Constructs a new application to be registered by Growl
* @param string $appName (optional) Application name
* @param array $notifications (optional) Array of notifications
* @param string $password (optional) Password to be used to notify Growl
* @param string $appIcon (optional) Application icon
* @throws InvalidArgumentException
* @see addGrowlNotifications()
* @see setGrowlName(), setGrowlPassword(), setGrowlIcon()
public function __construct($appName = null , $notifications = null ,
$password = null , $appIcon = null
if (!empty ($notifications)) {
* Adds notifications supported by this application
* Expected array format is:
* array('notification name' => array('option name' => 'option value'))
* At the moment, only option name 'enabled' is supported for UDP. Example:
* $notifications = array('Test Notification' => array('enabled' => true));
* @param array $notifications Array of notifications to support
* @throws InvalidArgumentException
throw new InvalidArgumentException;
$default = array ('enabled' => true );
foreach ($notifications as $name => $options) {
$this->_growlNotifications[$name] = $options;
* Returns the notifications accepted by Growl for this application
* Expected array format is:
* array('notification name' => array('option name' => 'option value'))
* At the moment, only option name 'enabled' is supported. Example:
* $notifications = array('Test Notification' => array('enabled' => true));
* @return array notifications
return $this->_growlNotifications;
* Sets the application name for registration in Growl
* @param string $appName Application name
* @throws InvalidArgumentException
throw new InvalidArgumentException;
$this->_growlAppName = $appName;
* Returns the application name for registration in Growl
* @return string application name
return $this->_growlAppName;
* Sets the password to be used by Growl to accept notification packets
* @param string $password Password to be used to notify Growl
* @throws InvalidArgumentException
* @see getGrowlPassword()
throw new InvalidArgumentException;
$this->_growlAppPassword = $password;
* Returns the password to be used by Growl to accept notification packets
* @return string password
* @see setGrowlPassword()
return $this->_growlAppPassword;
* Sets the application icon for registration in Growl
* @param mixed $appIcon Application icon
* @throws InvalidArgumentException
throw new InvalidArgumentException (
'Expect to be either a valid Url or a Net_Growl_Icon instance'
$this->_growlAppIcon = $appIcon;
* Returns the application icon for registration in Growl
* @return string application icon binary data or empty if default image
Documentation generated on Tue, 29 Jan 2013 18:30:03 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.
|