<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 5 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2019 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
+ | Copyright CiviCRM LLC. All rights reserved. |
| |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+ | This work is published under the GNU AGPLv3 license with some |
+ | permitted exceptions and without any warranty. For full license |
+ | and copyright information, see https://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
abstract class AbstractTokenSubscriber implements EventSubscriberInterface {
public static function getSubscribedEvents() {
- return array(
+ return [
Events::TOKEN_REGISTER => 'registerTokens',
Events::TOKEN_EVALUATE => 'evaluateTokens',
\Civi\ActionSchedule\Events::MAILING_QUERY => 'alterActionScheduleQuery',
- );
+ ];
}
/**
* @param array $tokenNames
* Array(string $tokenName => string $label).
*/
- public function __construct($entity, $tokenNames = array()) {
+ public function __construct($entity, $tokenNames = []) {
$this->entity = $entity;
$this->tokenNames = $tokenNames;
}
/**
* Register the declared tokens.
*
- * @param TokenRegisterEvent $e
+ * @param \Civi\Token\Event\TokenRegisterEvent $e
* The registration event. Add new tokens using register().
*/
public function registerTokens(TokenRegisterEvent $e) {
return;
}
foreach ($this->tokenNames as $name => $label) {
- $e->register(array(
+ $e->register([
'entity' => $this->entity,
'field' => $name,
'label' => $label,
- ));
+ ]);
}
}
* This is method is not always appropriate, but if you're specifically
* focused on scheduled reminders, it can be convenient.
*
- * @param MailingQueryEvent $e
+ * @param \Civi\ActionSchedule\Event\MailingQueryEvent $e
* The pending query which may be modified. See discussion on
* MailingQueryEvent::$query.
*/
/**
* Populate the token data.
*
- * @param TokenValueEvent $e
+ * @param \Civi\Token\Event\TokenValueEvent $e
* The event, which includes a list of rows and tokens.
*/
public function evaluateTokens(TokenValueEvent $e) {
* Any data that was returned by the prefetch().
* @return mixed
*/
- public abstract function evaluateToken(TokenRow $row, $entity, $field, $prefetch = NULL);
+ abstract public function evaluateToken(TokenRow $row, $entity, $field, $prefetch = NULL);
}