From e8e8f3ad30cfb845141215f053289d4b1711edfd Mon Sep 17 00:00:00 2001 From: eileenmcnaugton Date: Sat, 24 Oct 2015 09:00:44 +1300 Subject: [PATCH] comment fixes --- CRM/Contact/BAO/SavedSearch.php | 5 +- CRM/Contact/Form/Search/Builder.php | 22 ++++++++- CRM/Contribute/Tokens.php | 3 ++ CRM/Core/Page/QUnit.php | 7 ++- CRM/Member/Tokens.php | 7 +++ CRM/UF/Page/ProfileEditor.php | 10 +++- CRM/Upgrade/Form.php | 10 +--- CRM/Upgrade/Incremental/php/FourFour.php | 4 +- CRM/Upgrade/Page/Upgrade.php | 8 ++-- CRM/Upgrade/Snapshot/V4p2/Price/BAO/Field.php | 5 -- CRM/Upgrade/StateMachine.php | 2 - CRM/Utils/API/AbstractFieldCoder.php | 1 + CRM/Utils/API/MatchOption.php | 3 +- CRM/Utils/API/NullOutputCoder.php | 21 ++++----- CRM/Utils/ReCAPTCHA.php | 5 +- Civi/ActionSchedule/Mapping.php | 12 +++++ Civi/Core/Lock/LockInterface.php | 5 ++ Civi/Core/Paths.php | 10 ++++ Civi/Token/TokenRow.php | 46 ++++++++++++++++++- api/v3/Generic.php | 10 +++- 20 files changed, 151 insertions(+), 45 deletions(-) diff --git a/CRM/Contact/BAO/SavedSearch.php b/CRM/Contact/BAO/SavedSearch.php index e01b41c734..ba04075dbf 100644 --- a/CRM/Contact/BAO/SavedSearch.php +++ b/CRM/Contact/BAO/SavedSearch.php @@ -309,7 +309,7 @@ LEFT JOIN civicrm_email ON (contact_a.id = civicrm_email.contact_id AND civicrm_ } /** - * Given an id, get the name of the saved search + * Given an id, get the name of the saved search. * * @param int $id * The id of the saved search. @@ -329,8 +329,7 @@ LEFT JOIN civicrm_email ON (contact_a.id = civicrm_email.contact_id AND civicrm_ } /** - * Given a label and a set of normalized POST - * formValues, create a smart group with that + * Create a smart group from normalised values. * * @param array $params * diff --git a/CRM/Contact/Form/Search/Builder.php b/CRM/Contact/Form/Search/Builder.php index dfb2767d18..5577b25610 100644 --- a/CRM/Contact/Form/Search/Builder.php +++ b/CRM/Contact/Form/Search/Builder.php @@ -86,6 +86,9 @@ class CRM_Contact_Form_Search_Builder extends CRM_Contact_Form_Search { } } + /** + * Build quick form. + */ public function buildQuickForm() { $fields = self::fields(); // Get fields of type date @@ -151,7 +154,12 @@ class CRM_Contact_Form_Search_Builder extends CRM_Contact_Form_Search { // CRM-10338 $v[2] = self::checkArrayKeyEmpty($v[2]); - if (in_array($v[1], array('IS NULL', 'IS NOT NULL', 'IS EMPTY', 'IS NOT EMPTY')) && + if (in_array($v[1], array( + 'IS NULL', + 'IS NOT NULL', + 'IS EMPTY', + 'IS NOT EMPTY', + )) && !empty($v[2]) ) { $errorMsg["value[$v[3]][$v[4]]"] = ts('Please clear your value if you want to use %1 operator.', array(1 => $v[1])); @@ -281,11 +289,16 @@ class CRM_Contact_Form_Search_Builder extends CRM_Contact_Form_Search { return TRUE; } + /** + * Normalise form values. + */ public function normalizeFormValues() { } /** - * @param $formValues + * Convert form values. + * + * @param array $formValues * * @return array */ @@ -294,6 +307,8 @@ class CRM_Contact_Form_Search_Builder extends CRM_Contact_Form_Search { } /** + * Get return properties. + * * @return array */ public function &returnProperties() { @@ -386,6 +401,8 @@ class CRM_Contact_Form_Search_Builder extends CRM_Contact_Form_Search { } /** + * Get fields. + * * @return array */ public static function fields() { @@ -400,6 +417,7 @@ class CRM_Contact_Form_Search_Builder extends CRM_Contact_Form_Search { /** * CRM-9434 Hackish function to fetch fields with options. + * * FIXME: When our core fields contain reliable metadata this will be much simpler. * @return array * (string => string) key: field_name value: api entity name diff --git a/CRM/Contribute/Tokens.php b/CRM/Contribute/Tokens.php index 71f0926711..ad9972f5c9 100644 --- a/CRM/Contribute/Tokens.php +++ b/CRM/Contribute/Tokens.php @@ -72,6 +72,9 @@ class CRM_Contribute_Tokens extends \Civi\Token\AbstractTokenSubscriber { ); } + /** + * Class constructor. + */ public function __construct() { $tokens = CRM_Utils_Array::subset( CRM_Utils_Array::collect('title', CRM_Contribute_DAO_Contribution::fields()), diff --git a/CRM/Core/Page/QUnit.php b/CRM/Core/Page/QUnit.php index a3e541aa96..5920d7779c 100644 --- a/CRM/Core/Page/QUnit.php +++ b/CRM/Core/Page/QUnit.php @@ -9,6 +9,11 @@ require_once 'CRM/Core/Page.php'; class CRM_Core_Page_QUnit extends CRM_Core_Page { protected $tplFile = NULL; + /** + * Run. + * + * @throws \CRM_Core_Exception + */ public function run() { list ($ext, $suite) = $this->getRequestExtAndSuite(); if (empty($ext) || empty($suite)) { @@ -46,7 +51,7 @@ class CRM_Core_Page_QUnit extends CRM_Core_Page { } /** - * Extrac the extension and suite from the request path. + * Extract the extension and suite from the request path. * * @return array */ diff --git a/CRM/Member/Tokens.php b/CRM/Member/Tokens.php index 5c010e39fd..2adda80da4 100644 --- a/CRM/Member/Tokens.php +++ b/CRM/Member/Tokens.php @@ -55,6 +55,13 @@ class CRM_Member_Tokens extends \Civi\Token\AbstractTokenSubscriber { )); } + /** + * Is token active. + * + * @param \Civi\Token\TokenProcessor $processor + * + * @return bool + */ public function checkActive(\Civi\Token\TokenProcessor $processor) { // Extracted from scheduled-reminders code. See the class description. return diff --git a/CRM/UF/Page/ProfileEditor.php b/CRM/UF/Page/ProfileEditor.php index 588a2f28c7..d877b1b5c7 100644 --- a/CRM/UF/Page/ProfileEditor.php +++ b/CRM/UF/Page/ProfileEditor.php @@ -7,10 +7,18 @@ require_once 'CRM/Core/Page.php'; * widgets */ class CRM_UF_Page_ProfileEditor extends CRM_Core_Page { + /** + * Run page. + * + * @throws \Exception + */ public function run() { CRM_Core_Error::fatal('This is not a real page!'); } + /** + * Register profile scripts. + */ public static function registerProfileScripts() { static $loaded = FALSE; if ($loaded || CRM_Core_Resources::isAjaxMode()) { @@ -72,7 +80,7 @@ class CRM_UF_Page_ProfileEditor extends CRM_Core_Page { } /** - * Register entity schemas for use in the editor's palette + * Register entity schemas for use in the editor's palette. * * @param array $entityTypes * Strings, e.g. "IndividualModel", "ActivityModel". diff --git a/CRM/Upgrade/Form.php b/CRM/Upgrade/Form.php index 01f939b8fc..2edfbe6753 100644 --- a/CRM/Upgrade/Form.php +++ b/CRM/Upgrade/Form.php @@ -94,19 +94,11 @@ class CRM_Upgrade_Form extends CRM_Core_Form { * * @param object $state * State associated with this form. - * @param \const|\enum $action The mode the form is operating in (None/Create/View/Update/Delete) + * @param const|\enum|int $action The mode the form is operating in (None/Create/View/Update/Delete) * @param string $method * The type of http method used (GET/POST). * @param string $name * The name of the form if different from class name. - * - * @return \CRM_Core_Form - */ - /** - * @param null|object $state - * @param const|enum|int $action - * @param string $method - * @param null|string $name */ public function __construct( $state = NULL, diff --git a/CRM/Upgrade/Incremental/php/FourFour.php b/CRM/Upgrade/Incremental/php/FourFour.php index 59bbbb296c..3ede081998 100644 --- a/CRM/Upgrade/Incremental/php/FourFour.php +++ b/CRM/Upgrade/Incremental/php/FourFour.php @@ -97,7 +97,9 @@ WHERE ceft.entity_table = 'civicrm_contribution' AND cft.payment_instrument_id I } /** - * @param $rev + * Upgrade 4.4.alpha1. + * + * @param string $rev * * @return bool */ diff --git a/CRM/Upgrade/Page/Upgrade.php b/CRM/Upgrade/Page/Upgrade.php index 1abf6554bb..61e1ae1311 100644 --- a/CRM/Upgrade/Page/Upgrade.php +++ b/CRM/Upgrade/Page/Upgrade.php @@ -29,10 +29,12 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ class CRM_Upgrade_Page_Upgrade extends CRM_Core_Page { + + /** + * Pre-process. + */ public function preProcess() { parent::preProcess(); } @@ -85,7 +87,7 @@ class CRM_Upgrade_Page_Upgrade extends CRM_Core_Page { } /** - * Display an introductory screen with any pre-upgrade messages + * Display an introductory screen with any pre-upgrade messages. */ public function runIntro() { $upgrade = new CRM_Upgrade_Form(); diff --git a/CRM/Upgrade/Snapshot/V4p2/Price/BAO/Field.php b/CRM/Upgrade/Snapshot/V4p2/Price/BAO/Field.php index 567c0b0b09..11cc7234ee 100644 --- a/CRM/Upgrade/Snapshot/V4p2/Price/BAO/Field.php +++ b/CRM/Upgrade/Snapshot/V4p2/Price/BAO/Field.php @@ -29,13 +29,10 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ /** * Business objects for managing price fields. - * */ class CRM_Upgrade_Snapshot_V4p2_Price_BAO_Field extends CRM_Upgrade_Snapshot_V4p2_Price_DAO_Field { @@ -177,7 +174,6 @@ class CRM_Upgrade_Snapshot_V4p2_Price_BAO_Field extends CRM_Upgrade_Snapshot_V4p * * @return Object * DAO object on success, null otherwise - * */ public static function setIsActive($id, $is_active) { return CRM_Core_DAO::setFieldValue('CRM_Upgrade_Snapshot_V4p2_Price_DAO_Field', $id, 'is_active', $is_active); @@ -191,7 +187,6 @@ class CRM_Upgrade_Snapshot_V4p2_Price_BAO_Field extends CRM_Upgrade_Snapshot_V4p * * @return string * name - * */ public static function getTitle($id) { return CRM_Core_DAO::getFieldValue('CRM_Upgrade_Snapshot_V4p2_Price_DAO_Field', $id, 'label'); diff --git a/CRM/Upgrade/StateMachine.php b/CRM/Upgrade/StateMachine.php index 78fde5e86a..d344b14b81 100644 --- a/CRM/Upgrade/StateMachine.php +++ b/CRM/Upgrade/StateMachine.php @@ -29,8 +29,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ /** diff --git a/CRM/Utils/API/AbstractFieldCoder.php b/CRM/Utils/API/AbstractFieldCoder.php index 7108fbab85..7fd5850516 100644 --- a/CRM/Utils/API/AbstractFieldCoder.php +++ b/CRM/Utils/API/AbstractFieldCoder.php @@ -54,6 +54,7 @@ abstract class CRM_Utils_API_AbstractFieldCoder implements API_Wrapper { * Is field skipped. * * @param string $fldName + * * @return bool * TRUE if encoding should be skipped for this field */ diff --git a/CRM/Utils/API/MatchOption.php b/CRM/Utils/API/MatchOption.php index 43f5a57ee6..790f42a214 100644 --- a/CRM/Utils/API/MatchOption.php +++ b/CRM/Utils/API/MatchOption.php @@ -82,7 +82,7 @@ class CRM_Utils_API_MatchOption implements API_Wrapper { public function fromApiInput($apiRequest) { // Parse options.match or options.match-mandatory - $keys = NULL; // array of fields to match against + $keys = NULL; if (isset($apiRequest['params'], $apiRequest['params']['options']) && is_array($apiRequest['params']['options'])) { if (isset($apiRequest['params']['options']['match-mandatory'])) { $isMandatory = TRUE; @@ -141,6 +141,7 @@ class CRM_Utils_API_MatchOption implements API_Wrapper { * @param array $createParams * @param array $keys * @param bool $isMandatory + * * @return array * revised $createParams, including 'id' if known * @throws API_Exception diff --git a/CRM/Utils/API/NullOutputCoder.php b/CRM/Utils/API/NullOutputCoder.php index 8530ae46d4..77931c310f 100644 --- a/CRM/Utils/API/NullOutputCoder.php +++ b/CRM/Utils/API/NullOutputCoder.php @@ -56,19 +56,17 @@ class CRM_Utils_API_NullOutputCoder extends CRM_Utils_API_AbstractFieldCoder { } /** - * going to filter the - * submitted values across XSS vulnerability. + * Going to filter the submitted values across XSS vulnerability. * * @param array|string $values - * - * @internal param bool $castToString If TRUE, all scalars will be filtered (and therefore cast to strings) - * If FALSE, then non-string values will be preserved */ public function encodeInput(&$values) { } /** - * @param $values + * Decode output. + * + * @param array $values * @param bool $castToString */ public function decodeOutput(&$values, $castToString = FALSE) { @@ -85,13 +83,12 @@ class CRM_Utils_API_NullOutputCoder extends CRM_Utils_API_AbstractFieldCoder { } /** - * @inheritDoc - */ - /** - * @param $apiRequest - * @param $result + * To api output. + * + * @param array $apiRequest + * @param array $result * - * @return modified + * @return array */ public function toApiOutput($apiRequest, $result) { $lowerAction = strtolower($apiRequest['action']); diff --git a/CRM/Utils/ReCAPTCHA.php b/CRM/Utils/ReCAPTCHA.php index 8b211d0252..00bc33e605 100644 --- a/CRM/Utils/ReCAPTCHA.php +++ b/CRM/Utils/ReCAPTCHA.php @@ -41,17 +41,18 @@ class CRM_Utils_ReCAPTCHA { protected $_phrase = NULL; /** + * Singleton. + * * We only need one instance of this object. So we use the singleton * pattern and cache the instance in this variable * - * @var object + * @var CRM_Utils_ReCAPTCHA */ static private $_singleton = NULL; /** * Singleton function used to manage this object. * - * * @return object */ public static function &singleton() { diff --git a/Civi/ActionSchedule/Mapping.php b/Civi/ActionSchedule/Mapping.php index 7ec4247db9..de3ea72011 100644 --- a/Civi/ActionSchedule/Mapping.php +++ b/Civi/ActionSchedule/Mapping.php @@ -75,10 +75,22 @@ abstract class Mapping implements MappingInterface { 'entity_date_end', ); + /** + * Create mapping. + * + * @param array $params + * + * @return static + */ public static function create($params) { return new static($params); } + /** + * Class constructor. + * + * @param array $params + */ public function __construct($params) { foreach (self::$fields as $field) { if (isset($params[$field])) { diff --git a/Civi/Core/Lock/LockInterface.php b/Civi/Core/Lock/LockInterface.php index 2e174fd10a..317e46b5e0 100644 --- a/Civi/Core/Lock/LockInterface.php +++ b/Civi/Core/Lock/LockInterface.php @@ -26,9 +26,14 @@ */ namespace Civi\Core\Lock; +/** + * Lock interface. + */ interface LockInterface { /** + * Acquire lock. + * * @param int|NULL $timeout * The number of seconds to wait to get the lock. * For a default value, use NULL. diff --git a/Civi/Core/Paths.php b/Civi/Core/Paths.php index 8ec074f304..f486dbfdb9 100644 --- a/Civi/Core/Paths.php +++ b/Civi/Core/Paths.php @@ -26,6 +26,9 @@ class Paths { private $variableFactory = array(); + /** + * Class constructor. + */ public function __construct() { $this ->register('civicrm.root', function () { @@ -82,6 +85,13 @@ class Paths { return $this->variables[$name][$attr]; } + /** + * Does the variable exist. + * + * @param string $name + * + * @return bool + */ public function hasVariable($name) { return isset($this->variableFactory[$name]); } diff --git a/Civi/Token/TokenRow.php b/Civi/Token/TokenRow.php index d9347d0f6d..02d744eba0 100644 --- a/Civi/Token/TokenRow.php +++ b/Civi/Token/TokenRow.php @@ -249,20 +249,36 @@ class TokenRowContext implements \ArrayAccess, \IteratorAggregate, \Countable { protected $tokenRow; /** - * @param $tokenProcessor - * @param $tokenRow + * Class constructor. + * + * @param array $tokenProcessor + * @param array $tokenRow */ public function __construct($tokenProcessor, $tokenRow) { $this->tokenProcessor = $tokenProcessor; $this->tokenRow = $tokenRow; } + /** + * Does offset exist. + * + * @param mixed $offset + * + * @return bool + */ public function offsetExists($offset) { return isset($this->tokenProcessor->rowContexts[$this->tokenRow][$offset]) || isset($this->tokenProcessor->context[$offset]); } + /** + * Get offset. + * + * @param string $offset + * + * @return string + */ public function &offsetGet($offset) { if (isset($this->tokenProcessor->rowContexts[$this->tokenRow][$offset])) { return $this->tokenProcessor->rowContexts[$this->tokenRow][$offset]; @@ -274,22 +290,48 @@ class TokenRowContext implements \ArrayAccess, \IteratorAggregate, \Countable { return $val; } + /** + * Set offset. + * + * @param string $offset + * @param mixed $value + */ public function offsetSet($offset, $value) { $this->tokenProcessor->rowContexts[$this->tokenRow][$offset] = $value; } + /** + * Unset offset. + * + * @param mixed $offset + */ public function offsetUnset($offset) { unset($this->tokenProcessor->rowContexts[$this->tokenRow][$offset]); } + /** + * Get iterator. + * + * @return \ArrayIterator + */ public function getIterator() { return new \ArrayIterator($this->createMergedArray()); } + /** + * Count. + * + * @return int + */ public function count() { return count($this->createMergedArray()); } + /** + * Create merged array. + * + * @return array + */ protected function createMergedArray() { return array_merge( $this->tokenProcessor->rowContexts[$this->tokenRow], diff --git a/api/v3/Generic.php b/api/v3/Generic.php index d8f35dd467..5a420895b7 100644 --- a/api/v3/Generic.php +++ b/api/v3/Generic.php @@ -234,7 +234,15 @@ function civicrm_api3_generic_getfield($apiRequest) { return civicrm_api3_create_success($result, $apiRequest['params'], $apiRequest['entity'], 'getfield'); } - +/** + * Get metadata for getfield action. + * + * @param array $params + * @param array $apiRequest + * + * @throws \CiviCRM_API3_Exception + * @throws \Exception + */ function _civicrm_api3_generic_getfield_spec(&$params, $apiRequest) { $params = array( 'name' => array( -- 2.25.1