diff options
32 files changed, 259 insertions, 208 deletions
diff --git a/core/API/DataTableManipulator.php b/core/API/DataTableManipulator.php index dee8d80316..9c34eed898 100644 --- a/core/API/DataTableManipulator.php +++ b/core/API/DataTableManipulator.php @@ -89,8 +89,9 @@ abstract class Piwik_API_DataTableManipulator * Load the subtable for a row. * Returns null if none is found. * - * @param Piwik_Datatable_Row $row - * @throws Exception + * @param Piwik_DataTable $dataTable + * @param Piwik_DataTable_Row $row + * * @return Piwik_DataTable */ protected function loadSubtable($dataTable, $row) diff --git a/core/API/Request.php b/core/API/Request.php index 2abf779c52..e0147bb58d 100644 --- a/core/API/Request.php +++ b/core/API/Request.php @@ -168,7 +168,7 @@ class Piwik_API_Request * @param string $method The API method to call, ie, Actions.getPageTitles * @param array $paramOverride The parameter name-value pairs to use instead of what's * in $_GET & $_POST. - * @param mixed The result of the API request. + * @return mixed The result of the API request. */ public static function processRequest($method, $paramOverride = array()) { diff --git a/core/Archive/Single.php b/core/Archive/Single.php index 2f4d5e283e..3e805d4a98 100644 --- a/core/Archive/Single.php +++ b/core/Archive/Single.php @@ -380,8 +380,9 @@ class Piwik_Archive_Single extends Piwik_Archive /** * Fetches all blob fields name_* at once for the current archive for performance reasons. * - * @param $name - * @return + * @param string $name + * + * @return void */ public function preFetchBlob($name) { diff --git a/core/ArchiveProcessing.php b/core/ArchiveProcessing.php index 7ffa394ce9..ac74487217 100644 --- a/core/ArchiveProcessing.php +++ b/core/ArchiveProcessing.php @@ -694,6 +694,7 @@ abstract class Piwik_ArchiveProcessing /** * Returns the idArchive we will use for the current archive * + * @throws Exception * @return int IdArchive to use when saving the current Archive */ protected function loadNextIdarchive() @@ -826,9 +827,11 @@ abstract class Piwik_ArchiveProcessing /** * Inserts a record in the right table (either NUMERIC or BLOB) - * @param $name - * @param $value - * @return + * + * @param string $name + * @param mixed $value + * + * @return void */ protected function insertRecord($name, $value) { diff --git a/core/ArchiveProcessing/Day.php b/core/ArchiveProcessing/Day.php index 07921e9a50..75b48bde5c 100644 --- a/core/ArchiveProcessing/Day.php +++ b/core/ArchiveProcessing/Day.php @@ -408,19 +408,20 @@ class Piwik_ArchiveProcessing_Day extends Piwik_ArchiveProcessing /** * Query visits by dimension * - * @param array|string $label Can be a string, eg. "referer_name", will be aliased as 'label' in the returned rows - * Can also be an array of strings, when the dimension spans multiple fields, - * eg. array("referer_name", "referer_keyword") - * @param string $where Additional condition for WHERE clause - * @param bool|array $metrics Set this if you want to limit the columns that are returned. - * The possible values in the array are Piwik_Archive::INDEX_*. - * @param bool|string $orderBy ORDER BY clause. This is needed in combination with $rankingQuery. + * @param array|string $label Can be a string, eg. "referer_name", will be aliased as 'label' in the returned rows + * Can also be an array of strings, when the dimension spans multiple fields, + * eg. array("referer_name", "referer_keyword") + * @param string $where Additional condition for WHERE clause + * @param bool|array $metrics Set this if you want to limit the columns that are returned. + * The possible values in the array are Piwik_Archive::INDEX_*. + * @param bool|string $orderBy ORDER BY clause. This is needed in combination with $rankingQuery. * @param Piwik_RankingQuery $rankingQuery - * A pre-configured ranking query instance that is used to limit the result. - * If set, the return value is the array returned by Piwik_RankingQuery::execute(). - * @param string $addSelect Additional SELECT clause - * @param bool $addSelectGeneratesLabelColumn - * Set to true if the $label column is generated in $addSelect. + * A pre-configured ranking query instance that is used to limit the result. + * If set, the return value is the array returned by Piwik_RankingQuery::execute(). + * @param bool|string $addSelect Additional SELECT clause + * @param bool $addSelectGeneratesLabelColumn + * Set to true if the $label column is generated in $addSelect. + * * @return mixed */ public function queryVisitsByDimension($label, $where = '', $metrics = false, $orderBy = false, @@ -813,14 +814,14 @@ class Piwik_ArchiveProcessing_Day extends Piwik_ArchiveProcessing /** * Adds the given row $newRowToAdd to the existing $oldRowToUpdate passed by reference - * * The rows are php arrays Name => value * * @param array $newRowToAdd * @param array $oldRowToUpdate - * @param bool $onlyMetricsAvailableInActionsTable - * @param bool $doNotSumVisits - * @return + * @param bool $onlyMetricsAvailableInActionsTable + * @param bool $doNotSumVisits + * + * @return void */ public function updateInterestStats($newRowToAdd, &$oldRowToUpdate, $onlyMetricsAvailableInActionsTable = false, $doNotSumVisits = false) { diff --git a/core/Controller.php b/core/Controller.php index 9d97b6ff90..1687268cdf 100644 --- a/core/Controller.php +++ b/core/Controller.php @@ -301,9 +301,10 @@ abstract class Piwik_Controller * Returns a numeric value from the API. * Works only for API methods that originally returns numeric values (there is no cast here) * - * @param string $methodToCall Name of method to call, eg. Referers.getNumberOfDistinctSearchEngines - * @param string|false $date A custom date to use when getting the value. If false, the 'date' query - * parameter is used. + * @param string $methodToCall Name of method to call, eg. Referers.getNumberOfDistinctSearchEngines + * @param bool|string $date A custom date to use when getting the value. If false, the 'date' query + * parameter is used. + * * @return int|float */ protected function getNumericValue($methodToCall, $date = false) diff --git a/core/DataTable.php b/core/DataTable.php index ad27bc4a71..34d6fa6f8e 100644 --- a/core/DataTable.php +++ b/core/DataTable.php @@ -560,6 +560,7 @@ class Piwik_DataTable * Add a row to the table and rebuild the index if necessary * * @param Piwik_DataTable_Row $row to add at the end of the array + * @return Piwik_DataTable_Row */ public function addRow(Piwik_DataTable_Row $row) { @@ -809,9 +810,10 @@ class Piwik_DataTable /** * Deletes the ith row * - * @param int $id + * @param int $id + * * @throws Exception if the row $id cannot be found - * @return + * @return void */ public function deleteRow($id) { @@ -1066,7 +1068,7 @@ class Piwik_DataTable * array( col1_name => valueB, col2_name => valueD, ...), * ) * @throws Exception - * @return + * @return void */ public function addRowsFromSimpleArray($array) { @@ -1289,18 +1291,18 @@ class Piwik_DataTable * Traverses a DataTable tree using an array of labels and returns the row * it finds or false if it cannot find one, and the number of segments of * the path successfully walked. - * * If $missingRowColumns is supplied, the specified path is created. When * a subtable is encountered w/o the queried label, a new row is created * with the label, and a subtable is added to the row. * - * @param array $path The path to walk. An array of label values. - * @param array|false $missingRowColumns - * The default columns to use when creating new arrays. - * If this parameter is supplied, new rows will be - * created if labels cannot be found. - * @param int $maxSubtableRows The maximum number of allowed rows in new - * subtables. + * @param array $path The path to walk. An array of label values. + * @param array|bool $missingRowColumns + * The default columns to use when creating new arrays. + * If this parameter is supplied, new rows will be + * created if labels cannot be found. + * @param int $maxSubtableRows The maximum number of allowed rows in new + * subtables. + * * @return array First element is the found row or false. Second element is * the number of path segments walked. If a row is found, this * will be == to count($path). Otherwise, it will be the index @@ -1357,15 +1359,15 @@ class Piwik_DataTable } /** - * Returns a new DataTable that contains the rows of each of this table's - * subtables. + * Returns a new DataTable that contains the rows of each of this table's subtables. * - * @param string|false $labelColumn If supplied the label of the parent row will be - * added to a new column in each subtable row. If set to, + * @param string|bool $labelColumn If supplied the label of the parent row will be + * added to a new column in each subtable row. If set to, * 'label' each subtable row's label will be prepended w/ - * the parent row's label. - * @param bool $useMetadataColumn If true and if $labelColumn is supplied, the parent row's - * label will be added as metadata. + * the parent row's label. + * @param bool $useMetadataColumn If true and if $labelColumn is supplied, the parent row's + * label will be added as metadata. + * * @return Piwik_DataTable */ public function mergeSubtables($labelColumn = false, $useMetadataColumn = false) diff --git a/core/DataTable/Filter/CalculateEvolutionFilter.php b/core/DataTable/Filter/CalculateEvolutionFilter.php index 2cacaf2698..f4ad1ea480 100755 --- a/core/DataTable/Filter/CalculateEvolutionFilter.php +++ b/core/DataTable/Filter/CalculateEvolutionFilter.php @@ -36,9 +36,10 @@ class Piwik_DataTable_Filter_CalculateEvolutionFilter extends Piwik_DataTable_Fi * Constructor. * * @param Piwik_DataTable $table The DataTable being filtered. - * @param string $columnToAdd - * @param string $columnToRead - * @param int $quotientPrecision + * @param string $pastDataTable + * @param string $columnToAdd + * @param string $columnToRead + * @param int $quotientPrecision */ function __construct($table, $pastDataTable, $columnToAdd, $columnToRead, $quotientPrecision = 0) { @@ -127,10 +128,11 @@ class Piwik_DataTable_Filter_CalculateEvolutionFilter extends Piwik_DataTable_Fi /** * Calculates the evolution percentage for two arbitrary values. * - * @param numeric $currentValue The current metric value. - * @param numeric $pastValue The value of the metric in the past. We measure the % change - * from this value to $currentValue. - * @param numeric $quotientPrecision The quotient precision to round to. + * @param float|int $currentValue The current metric value. + * @param float|int $pastValue The value of the metric in the past. We measure the % change + * from this value to $currentValue. + * @param float|int $quotientPrecision The quotient precision to round to. + * * @return string The evolution percent 15% */ public static function calculate($currentValue, $pastValue, $quotientPrecision = 0) diff --git a/core/DataTable/Filter/ColumnCallbackAddMetadata.php b/core/DataTable/Filter/ColumnCallbackAddMetadata.php index 27bd0170b5..2ce2ad19dc 100644 --- a/core/DataTable/Filter/ColumnCallbackAddMetadata.php +++ b/core/DataTable/Filter/ColumnCallbackAddMetadata.php @@ -29,10 +29,11 @@ class Piwik_DataTable_Filter_ColumnCallbackAddMetadata extends Piwik_DataTable_F /** * @param Piwik_DataTable $table - * @param $columnToRead - * @param $metadataToAdd - * @param null $functionToApply - * @param null $functionParameters + * @param string $columnToRead + * @param string $metadataToAdd + * @param string $functionToApply + * @param array $functionParameters + * @param bool $applyToSummaryRow */ public function __construct($table, $columnToRead, $metadataToAdd, $functionToApply = null, $functionParameters = null, $applyToSummaryRow = true) diff --git a/core/DataTable/Filter/ColumnDelete.php b/core/DataTable/Filter/ColumnDelete.php index 471315dd4a..3ac3f5b244 100644 --- a/core/DataTable/Filter/ColumnDelete.php +++ b/core/DataTable/Filter/ColumnDelete.php @@ -44,11 +44,12 @@ class Piwik_DataTable_Filter_ColumnDelete extends Piwik_DataTable_Filter * Constructor. * * @param Piwik_DataTable $table - * @param array|string $columnsToRemove An array of column names or a comma-separated list of - * column names. These columns will be removed. - * @param array|string $columnsToKeep An array of column names that should be kept or a - * comma-separated list of column names. Columns not in - * this list will be removed. + * @param array|string $columnsToRemove An array of column names or a comma-separated list of + * column names. These columns will be removed. + * @param array|string $columnsToKeep An array of column names that should be kept or a + * comma-separated list of column names. Columns not in + * this list will be removed. + * @param bool $deleteIfZeroOnly */ public function __construct($table, $columnsToRemove, $columnsToKeep = array(), $deleteIfZeroOnly = false) { diff --git a/core/DataTable/Filter/Limit.php b/core/DataTable/Filter/Limit.php index 5241b466e2..7845727948 100644 --- a/core/DataTable/Filter/Limit.php +++ b/core/DataTable/Filter/Limit.php @@ -59,7 +59,7 @@ class Piwik_DataTable_Filter_Limit extends Piwik_DataTable_Filter $table->deleteRowsOffset($this->limit); } - if ($this->keepSummaryRow && $summaryRow) { + if ($this->keepSummaryRow && !empty($summaryRow)) { $table->addSummaryRow($summaryRow); } } diff --git a/core/DataTable/Row.php b/core/DataTable/Row.php index 8fb60b0f29..63263d61ca 100644 --- a/core/DataTable/Row.php +++ b/core/DataTable/Row.php @@ -413,6 +413,8 @@ class Piwik_DataTable_Row * Add columns to the row * * @param array $columns Name/Value pairs, e.g., array( name => value , ...) + * + * @throws Exception * @return void */ public function addColumns($columns) @@ -448,12 +450,12 @@ class Piwik_DataTable_Row * Sums the given $row columns values to the existing row' columns values. * It will sum only the int or float values of $row. * It will not sum the column 'label' even if it has a numeric value. - * * If a given column doesn't exist in $this then it is added with the value of $row. * If the column already exists in $this then we have * this.columns[idThisCol] += $row.columns[idThisCol] * * @param Piwik_DataTable_Row $rowToSum + * @param bool $enableCopyMetadata */ public function sumRow(Piwik_DataTable_Row $rowToSum, $enableCopyMetadata = true) { @@ -503,8 +505,10 @@ class Piwik_DataTable_Row /** * Helper function: sums 2 values * - * @param number|bool $thisColumnValue + * @param number|bool $thisColumnValue * @param number|array $columnToSumValue + * + * @throws Exception * @return array|int */ protected function sumRowArray($thisColumnValue, $columnToSumValue) diff --git a/core/FrontController.php b/core/FrontController.php index 8f136acd65..33fb7107dd 100644 --- a/core/FrontController.php +++ b/core/FrontController.php @@ -181,7 +181,9 @@ class Piwik_FrontController /** * Loads the config file and assign to the global registry - * This is overriden in tests to ensure test config file is used + * This is overridden in tests to ensure test config file is used + * + * @return Exception */ protected function createConfigObject() { @@ -207,10 +209,9 @@ class Piwik_FrontController * - loads the plugin, * - inits the DB connection, * - etc. + * * @throws Exception - * @throws Exception - * @throws bool|Exception - * @return + * @return void */ function init() { diff --git a/core/Http.php b/core/Http.php index 1b0e328184..186ad321e2 100644 --- a/core/Http.php +++ b/core/Http.php @@ -49,20 +49,20 @@ class Piwik_Http /** * Sends http request ensuring the request will fail before $timeout seconds - * * If no $destinationPath is specified, the trimmed response (without header) is returned as a string. * If a $destinationPath is specified, the response (without header) is saved to a file. * - * @param string $aUrl - * @param int $timeout - * @param string $userAgent - * @param string $destinationPath - * @param int $followDepth - * @param bool $acceptLanguage - * @param array $byteRange For Range: header. Should be two element array of bytes, eg, array(0, 1024) - * Doesn't work w/ fopen method. - * @param bool $getExtendedInfo True to return status code, headers & response, false if just response. - * @param string $httpMethod The HTTP method to use. Defaults to 'GET'. + * @param string $aUrl + * @param int $timeout + * @param string $userAgent + * @param string $destinationPath + * @param int $followDepth + * @param bool $acceptLanguage + * @param array|bool $byteRange For Range: header. Should be two element array of bytes, eg, array(0, 1024) + * Doesn't work w/ fopen method. + * @param bool $getExtendedInfo True to return status code, headers & response, false if just response. + * @param string $httpMethod The HTTP method to use. Defaults to 'GET'. + * * @throws Exception * @return bool true (or string) on success; false on HTTP response error code (1xx or 4xx) */ @@ -86,19 +86,20 @@ class Piwik_Http /** * Sends http request using the specified transport method * - * @param string $method - * @param string $aUrl - * @param int $timeout - * @param string $userAgent - * @param string $destinationPath - * @param resource $file - * @param int $followDepth + * @param string $method + * @param string $aUrl + * @param int $timeout + * @param string $userAgent + * @param string $destinationPath + * @param resource $file + * @param int $followDepth * @param bool|string $acceptLanguage Accept-language header - * @param bool $acceptInvalidSslCertificate Only used with $method == 'curl'. If set to true (NOT recommended!) the SSL certificate will not be checked - * @param array $byteRange For Range: header. Should be two element array of bytes, eg, array(0, 1024) - * Doesn't work w/ fopen method. - * @param bool $getExtendedInfo True to return status code, headers & response, false if just response. - * @param string $httpMethod The HTTP method to use. Defaults to 'GET'. + * @param bool $acceptInvalidSslCertificate Only used with $method == 'curl'. If set to true (NOT recommended!) the SSL certificate will not be checked + * @param array|bool $byteRange For Range: header. Should be two element array of bytes, eg, array(0, 1024) + * Doesn't work w/ fopen method. + * @param bool $getExtendedInfo True to return status code, headers & response, false if just response. + * @param string $httpMethod The HTTP method to use. Defaults to 'GET'. + * * @throws Exception * @return bool true (or string/array) on success; false on HTTP response error code (1xx or 4xx) */ @@ -532,14 +533,16 @@ class Piwik_Http * Downloads the next chunk of a specific file. The next chunk's byte range * is determined by the existing file's size and the expected file size, which * is stored in the piwik_option table before starting a download. - * * Note this function uses the Range HTTP header to accomplish downloading in * parts. * - * @param string $url The url to download from. - * @param string $outputPath The path to the file to save/append to. - * @param bool $isContinuation True if this is the continuation of a download, - * or if we're starting a fresh one. + * @param string $url The url to download from. + * @param string $outputPath The path to the file to save/append to. + * @param bool $isContinuation True if this is the continuation of a download, + * or if we're starting a fresh one. + * + * @throws Exception + * @return array */ public static function downloadChunk($url, $outputPath, $isContinuation) { diff --git a/core/Mail.php b/core/Mail.php index 833e01fdb6..77cb44bef4 100644 --- a/core/Mail.php +++ b/core/Mail.php @@ -34,6 +34,7 @@ class Piwik_Mail extends Zend_Mail * * @param string $email * @param null|string $name + * @return Zend_Mail */ public function setFrom($email, $name = null) { @@ -50,7 +51,7 @@ class Piwik_Mail extends Zend_Mail $piwikHost = $url['host']; } $email = str_replace('{DOMAIN}', $piwikHost, $email); - parent::setFrom($email, $name); + return parent::setFrom($email, $name); } /** diff --git a/core/Menu/Abstract.php b/core/Menu/Abstract.php index 553a34489e..4388a70032 100644 --- a/core/Menu/Abstract.php +++ b/core/Menu/Abstract.php @@ -44,12 +44,12 @@ abstract class Piwik_Menu_Abstract /** * Adds a new entry to the menu. * - * @param string $menuName - * @param string $subMenuName - * @param string $url - * @param bool $displayedForCurrentUser - * @param int $order - * @param string $tooltip Tooltip to display. + * @param string $menuName + * @param string $subMenuName + * @param string $url + * @param bool $displayedForCurrentUser + * @param int $order + * @param bool|string $tooltip Tooltip to display. */ public function add($menuName, $subMenuName, $url, $displayedForCurrentUser, $order = 50, $tooltip = false) { @@ -73,11 +73,11 @@ abstract class Piwik_Menu_Abstract /** * Builds a single menu item * - * @param string $menuName - * @param string $subMenuName - * @param string $url - * @param int $order - * @param string $tooltip Tooltip to display. + * @param string $menuName + * @param string $subMenuName + * @param string $url + * @param int $order + * @param bool|string $tooltip Tooltip to display. */ private function buildMenuItem($menuName, $subMenuName, $url, $order = 50, $tooltip = false) { diff --git a/core/Menu/Top.php b/core/Menu/Top.php index f24822ac26..b3438c906c 100644 --- a/core/Menu/Top.php +++ b/core/Menu/Top.php @@ -75,12 +75,12 @@ function Piwik_GetTopMenu() /** * Adds a new entry to the TopMenu. * - * @param string $topMenuName - * @param string $data - * @param boolean $displayedForCurrentUser - * @param int $order - * @param bool $isHTML - * @param string $tooltip Tooltip to display. + * @param string $topMenuName + * @param string $data + * @param boolean $displayedForCurrentUser + * @param int $order + * @param bool $isHTML + * @param bool|string $tooltip Tooltip to display. */ function Piwik_AddTopMenu($topMenuName, $data, $displayedForCurrentUser = true, $order = 10, $isHTML = false, $tooltip = false) diff --git a/core/Period/Range.php b/core/Period/Range.php index 38dd9b350e..c73f10b4fe 100644 --- a/core/Period/Range.php +++ b/core/Period/Range.php @@ -340,8 +340,9 @@ class Piwik_Period_Range extends Piwik_Period /** * Returns the date that is one period before the supplied date. * - * @param string $date The date to get the last date of. - * @param string $period The period to use (either 'day', 'week', 'month', 'year'); + * @param bool|string $date The date to get the last date of. + * @param bool|string $period The period to use (either 'day', 'week', 'month', 'year'); + * * @return array An array with two elements, a string for the date before $date and * a Piwik_Period instance for the period before $date. */ diff --git a/core/Piwik.php b/core/Piwik.php index 0fb50979bc..21a5a24d58 100644 --- a/core/Piwik.php +++ b/core/Piwik.php @@ -2243,10 +2243,11 @@ class Piwik * Batch insert into table from CSV (or other delimited) file. * * @param string $tableName Name of table - * @param array $fields Field names + * @param array $fields Field names * @param string $filePath Path name of a file. - * @param array $fileSpec File specifications (delimiter, line terminator, etc) - * @param book $throwException Should re-throw any exception, used in system check + * @param array $fileSpec File specifications (delimiter, line terminator, etc) + * + * @throws Exception * @return bool True if successful; false otherwise */ static public function createTableFromCSVFile($tableName, $fields, $filePath, $fileSpec) diff --git a/core/PluginsFunctions/Sql.php b/core/PluginsFunctions/Sql.php index 5b2f2ee45a..95c5ace1e0 100644 --- a/core/PluginsFunctions/Sql.php +++ b/core/PluginsFunctions/Sql.php @@ -233,14 +233,15 @@ class Piwik_Sql * Performs a SELECT on a table one chunk at a time and returns the first * fetched value. * - * @param string $sql The SQL to perform. The last two conditions of the WHERE - * expression must be as follows: 'id >= ? AND id < ?' where - * 'id' is the int id of the table. If $step < 0, the condition - * should be 'id <= ? AND id > ?'. - * @param int $first The minimum ID to loop from. - * @param int $last The maximum ID to loop to. - * @param int $step The maximum number of rows to scan in each smaller SELECT. - * @param array $parameters Parameters to bind in the query, array( param1 => value1, param2 => value2) + * @param string $sql The SQL to perform. The last two conditions of the WHERE + * expression must be as follows: 'id >= ? AND id < ?' where + * 'id' is the int id of the table. If $step < 0, the condition + * should be 'id <= ? AND id > ?'. + * @param int $first The minimum ID to loop from. + * @param int $last The maximum ID to loop to. + * @param int $step The maximum number of rows to scan in each smaller SELECT. + * @param array $params parameters to bind in the query, array( param1 => value1, param2 => value2) + * * @return array */ static public function segmentedFetchFirst($sql, $first, $last, $step, $params) @@ -262,13 +263,14 @@ class Piwik_Sql * Performs a SELECT on a table one chunk at a time and returns an array * of every fetched value. * - * @param string $sql The SQL to perform. The last two conditions of the WHERE - * expression must be as follows: 'id >= ? AND id < ?' where - * 'id' is the int id of the table. - * @param int $first The minimum ID to loop from. - * @param int $last The maximum ID to loop to. - * @param int $step The maximum number of rows to scan in each smaller SELECT. - * @param array $parameters Parameters to bind in the query, array( param1 => value1, param2 => value2) + * @param string $sql The SQL to perform. The last two conditions of the WHERE + * expression must be as follows: 'id >= ? AND id < ?' where + * 'id' is the int id of the table. + * @param int $first The minimum ID to loop from. + * @param int $last The maximum ID to loop to. + * @param int $step The maximum number of rows to scan in each smaller SELECT. + * @param array $params Parameters to bind in the query, array( param1 => value1, param2 => value2) + * * @return array */ static public function segmentedFetchOne($sql, $first, $last, $step, $params) @@ -290,13 +292,14 @@ class Piwik_Sql * Performs a SELECT on a table one chunk at a time and returns an array * of every fetched row. * - * @param string $sql The SQL to perform. The last two conditions of the WHERE - * expression must be as follows: 'id >= ? AND id < ?' where - * 'id' is the int id of the table. - * @param int $first The minimum ID to loop from. - * @param int $last The maximum ID to loop to. - * @param int $step The maximum number of rows to scan in each smaller SELECT. - * @param array $parameters Parameters to bind in the query, array( param1 => value1, param2 => value2) + * @param string $sql The SQL to perform. The last two conditions of the WHERE + * expression must be as follows: 'id >= ? AND id < ?' where + * 'id' is the int id of the table. + * @param int $first The minimum ID to loop from. + * @param int $last The maximum ID to loop to. + * @param int $step The maximum number of rows to scan in each smaller SELECT. + * @param array $params Parameters to bind in the query, array( param1 => value1, param2 => value2) + * * @return array */ static public function segmentedFetchAll($sql, $first, $last, $step, $params) @@ -319,13 +322,14 @@ class Piwik_Sql /** * Performs a non-SELECT query on a table one chunk at a time. * - * @param string $sql The SQL to perform. The last two conditions of the WHERE - * expression must be as follows: 'id >= ? AND id < ?' where - * 'id' is the int id of the table. - * @param int $first The minimum ID to loop from. - * @param int $last The maximum ID to loop to. - * @param int $step The maximum number of rows to scan in each smaller query. - * @param array $parameters Parameters to bind in the query, array( param1 => value1, param2 => value2) + * @param string $sql The SQL to perform. The last two conditions of the WHERE + * expression must be as follows: 'id >= ? AND id < ?' where + * 'id' is the int id of the table. + * @param int $first The minimum ID to loop from. + * @param int $last The maximum ID to loop to. + * @param int $step The maximum number of rows to scan in each smaller query. + * @param array $params Parameters to bind in the query, array( param1 => value1, param2 => value2) + * * @return array */ static public function segmentedQuery($sql, $first, $last, $step, $params) @@ -553,13 +557,14 @@ function Piwik_UnlockAllTables() * * @see Piwik_Sql::segmentedFetchFirst * - * @param string $sql The SQL to perform. The last two conditions of the WHERE - * expression must be as follows: 'id >= ? AND id < ?' where - * 'id' is the int id of the table. - * @param int $first The minimum ID to loop from. - * @param int $last The maximum ID to loop to. - * @param int $step The maximum number of rows to scan in each smaller SELECT. - * @param array $parameters Parameters to bind in the query, array( param1 => value1, param2 => value2) + * @param string $sql The SQL to perform. The last two conditions of the WHERE + * expression must be as follows: 'id >= ? AND id < ?' where + * 'id' is the int id of the table. + * @param int $first The minimum ID to loop from. + * @param int $last The maximum ID to loop to. + * @param int $step The maximum number of rows to scan in each smaller SELECT. + * @param array $params Parameters to bind in the query, array( param1 => value1, param2 => value2) + * * @return string */ function Piwik_SegmentedFetchFirst($sql, $first, $last, $step, $params = array()) @@ -578,13 +583,14 @@ function Piwik_SegmentedFetchFirst($sql, $first, $last, $step, $params = array() * * @see Piwik_Sql::segmentedFetchFirst * - * @param string $sql The SQL to perform. The last two conditions of the WHERE - * expression must be as follows: 'id >= ? AND id < ?' where - * 'id' is the int id of the table. - * @param int $first The minimum ID to loop from. - * @param int $last The maximum ID to loop to. - * @param int $step The maximum number of rows to scan in each smaller SELECT. - * @param array $parameters Parameters to bind in the query, array( param1 => value1, param2 => value2) + * @param string $sql The SQL to perform. The last two conditions of the WHERE + * expression must be as follows: 'id >= ? AND id < ?' where + * 'id' is the int id of the table. + * @param int $first The minimum ID to loop from. + * @param int $last The maximum ID to loop to. + * @param int $step The maximum number of rows to scan in each smaller SELECT. + * @param array $params Parameters to bind in the query, array( param1 => value1, param2 => value2) + * * @return array */ function Piwik_SegmentedFetchOne($sql, $first, $last, $step, $params = array()) @@ -603,13 +609,14 @@ function Piwik_SegmentedFetchOne($sql, $first, $last, $step, $params = array()) * * @see Piwik_Sql::segmentedFetchFirst * - * @param string $sql The SQL to perform. The last two conditions of the WHERE - * expression must be as follows: 'id >= ? AND id < ?' where - * 'id' is the int id of the table. - * @param int $first The minimum ID to loop from. - * @param int $last The maximum ID to loop to. - * @param int $step The maximum number of rows to scan in each smaller SELECT. - * @param array $parameters Parameters to bind in the query, array( param1 => value1, param2 => value2) + * @param string $sql The SQL to perform. The last two conditions of the WHERE + * expression must be as follows: 'id >= ? AND id < ?' where + * 'id' is the int id of the table. + * @param int $first The minimum ID to loop from. + * @param int $last The maximum ID to loop to. + * @param int $step The maximum number of rows to scan in each smaller SELECT. + * @param array $params Parameters to bind in the query, array( param1 => value1, param2 => value2) + * * @return array */ function Piwik_SegmentedFetchAll($sql, $first, $last, $step, $params = array()) @@ -628,13 +635,14 @@ function Piwik_SegmentedFetchAll($sql, $first, $last, $step, $params = array()) * * @see Piwik_Sql::segmentedQuery * - * @param string $sql The SQL to perform. The last two conditions of the WHERE - * expression must be as follows: 'id >= ? AND id < ?' where - * 'id' is the int id of the table. - * @param int $first The minimum ID to loop from. - * @param int $last The maximum ID to loop to. - * @param int $step The maximum number of rows to scan in each smaller query. - * @param array $parameters Parameters to bind in the query, array( param1 => value1, param2 => value2) + * @param string $sql The SQL to perform. The last two conditions of the WHERE + * expression must be as follows: 'id >= ? AND id < ?' where + * 'id' is the int id of the table. + * @param int $first The minimum ID to loop from. + * @param int $last The maximum ID to loop to. + * @param int $step The maximum number of rows to scan in each smaller query. + * @param array $params Parameters to bind in the query, array( param1 => value1, param2 => value2) + * * @return array */ function Piwik_SegmentedQuery($sql, $first, $last, $step, $params = array()) diff --git a/core/Tracker.php b/core/Tracker.php index 935ffbf3ca..89fa433836 100644 --- a/core/Tracker.php +++ b/core/Tracker.php @@ -781,6 +781,7 @@ function Piwik_Tracker_GetErrorMessage($e) * Displays exception in a friendly UI and exits. * * @param Exception $e + * @param bool $authenticated */ function Piwik_Tracker_ExitWithException($e, $authenticated = false) { diff --git a/core/Tracker/Action.php b/core/Tracker/Action.php index 388732672d..5d6bd32658 100644 --- a/core/Tracker/Action.php +++ b/core/Tracker/Action.php @@ -256,7 +256,8 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface * from http://example.org/thing;paramA=1;paramB=6542 * to http://example.org/thing?paramA=1¶mB=6542 * - * @param string $url + * @param string $originalUrl + * @return string */ static public function convertMatrixUrl($originalUrl) { @@ -290,7 +291,7 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface * and deal ith the hash tag on incoming URLs based on website setting. * * @param $parsedUrl - * @param $idSite int|false The site ID of the current visit. This parameter is + * @param $idSite int|bool The site ID of the current visit. This parameter is * only used by the tracker to see if we should remove * the URL fragment for this site. * @return array @@ -314,10 +315,11 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface /** * Cleans and/or removes the URL fragment of a URL. * - * @param $urlFragment string The URL fragment to process. - * @param $idSite int|false If not false, this function will check if URL fragments + * @param $urlFragment string The URL fragment to process. + * @param $idSite int|bool If not false, this function will check if URL fragments * should be removed for the site w/ this ID and if so, * the returned processed fragment will be empty. + * * @return string The processed URL fragment. */ public static function processUrlFragment($urlFragment, $idSite = false) @@ -1043,15 +1045,16 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface /** * Checks if query parameters are of a non-UTF-8 encoding and converts the values * from the specified encoding to UTF-8. - * * This method is used to workaround browser/webapp bugs (see #3450). When * browsers fail to encode query parameters in UTF-8, the tracker will send the * charset of the page viewed and we can sometimes work around invalid data * being stored. * - * @param array $queryParameters Name/value mapping of query parameters. - * @param string|false $encoding of the HTML page the URL is for. Used to workaround - * browser bugs & mis-coded webapps. See #3450. + * @param array $queryParameters Name/value mapping of query parameters. + * @param bool|string $encoding of the HTML page the URL is for. Used to workaround + * browser bugs & mis-coded webapps. See #3450. + * + * @return array */ private static function reencodeParameters(&$queryParameters, $encoding = false) { diff --git a/core/Tracker/Db/Mysqli.php b/core/Tracker/Db/Mysqli.php index 193bdff203..32c16c3e1f 100644 --- a/core/Tracker/Db/Mysqli.php +++ b/core/Tracker/Db/Mysqli.php @@ -83,7 +83,7 @@ class Piwik_Tracker_Db_Mysqli extends Piwik_Tracker_Db $this->password = ''; - if (self::$profiling) { + if (self::$profiling && isset($timer)) { $this->recordQueryProfile('connect', $timer); } } @@ -126,7 +126,7 @@ class Piwik_Tracker_Db_Mysqli extends Piwik_Tracker_Db } mysqli_free_result($rs); - if (self::$profiling) { + if (self::$profiling && isset($timer)) { $this->recordQueryProfile($query, $timer); } return $rows; @@ -160,7 +160,7 @@ class Piwik_Tracker_Db_Mysqli extends Piwik_Tracker_Db $row = mysqli_fetch_array($rs, MYSQLI_ASSOC); mysqli_free_result($rs); - if (self::$profiling) { + if (self::$profiling && isset($timer)) { $this->recordQueryProfile($query, $timer); } return $row; @@ -195,7 +195,7 @@ class Piwik_Tracker_Db_Mysqli extends Piwik_Tracker_Db mysqli_free_result($result); } - if (self::$profiling) { + if (self::$profiling && isset($timer)) { $this->recordQueryProfile($query, $timer); } return $result; diff --git a/core/Tracker/Db/Pdo/Mysql.php b/core/Tracker/Db/Pdo/Mysql.php index 23f87d4d85..aaca0b2780 100644 --- a/core/Tracker/Db/Pdo/Mysql.php +++ b/core/Tracker/Db/Pdo/Mysql.php @@ -76,7 +76,7 @@ class Piwik_Tracker_Db_Pdo_Mysql extends Piwik_Tracker_Db $this->connection->exec($sql); } - if (self::$profiling) { + if (self::$profiling && isset($timer)) { $this->recordQueryProfile('connect', $timer); } } @@ -158,7 +158,7 @@ class Piwik_Tracker_Db_Pdo_Mysql extends Piwik_Tracker_Db $sth = $this->connection->prepare($query); $sth->execute($parameters); - if (self::$profiling) { + if (self::$profiling && isset($timer)) { $this->recordQueryProfile($query, $timer); } return $sth; diff --git a/core/Tracker/Db/Pdo/Pgsql.php b/core/Tracker/Db/Pdo/Pgsql.php index c03246b348..f6c282d156 100644 --- a/core/Tracker/Db/Pdo/Pgsql.php +++ b/core/Tracker/Db/Pdo/Pgsql.php @@ -52,7 +52,7 @@ class Piwik_Tracker_Db_Pdo_Pgsql extends Piwik_Tracker_Db_Pdo_Mysql $this->connection->exec($sql); } - if (self::$profiling) { + if (self::$profiling && isset($timer)) { $this->recordQueryProfile('connect', $timer); } } diff --git a/core/Tracker/GoalManager.php b/core/Tracker/GoalManager.php index a00c49ad3f..8b6fada06a 100644 --- a/core/Tracker/GoalManager.php +++ b/core/Tracker/GoalManager.php @@ -202,14 +202,16 @@ class Piwik_Tracker_GoalManager /** * Records one or several goals matched in this request. - * @param int $idSite - * @param array $visitorInformation - * @param array $visitCustomVariables + * + * @param int $idSite + * @param array $visitorInformation + * @param array $visitCustomVariables * @param string $action - * @param $referrerTimestamp + * @param int $referrerTimestamp * @param string $referrerUrl * @param string $referrerCampaignName * @param string $referrerCampaignKeyword + * @param string $browserLanguage */ public function recordGoals($idSite, $visitorInformation, $visitCustomVariables, $action, $referrerTimestamp, $referrerUrl, $referrerCampaignName, $referrerCampaignKeyword, $browserLanguage) { @@ -625,9 +627,11 @@ class Piwik_Tracker_GoalManager /** * Updates the cart items in the DB * that have been modified since the last cart update - * @param $goal - * @param array $itemsToUpdate - * @return + * + * @param array $goal + * @param array $itemsToUpdate + * + * @return void */ protected function updateEcommerceItems($goal, $itemsToUpdate) { @@ -660,9 +664,11 @@ class Piwik_Tracker_GoalManager /** * Inserts in the cart in the DB the new items * that were not previously in the cart - * @param $goal + * + * @param array $goal * @param array $itemsToInsert - * @return + * + * @return void */ protected function insertEcommerceItems($goal, $itemsToInsert) { diff --git a/core/Tracker/Visit.php b/core/Tracker/Visit.php index c4a661ec62..433a7ee5cd 100644 --- a/core/Tracker/Visit.php +++ b/core/Tracker/Visit.php @@ -747,6 +747,8 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface /** * Returns the visitor's browser (user agent) * + * @param array $request request array to use + * * @return string */ static public function getUserAgent($request) diff --git a/core/UpdateCheck.php b/core/UpdateCheck.php index bbe2ad786d..e79d5df431 100644 --- a/core/UpdateCheck.php +++ b/core/UpdateCheck.php @@ -25,7 +25,8 @@ class Piwik_UpdateCheck /** * Check for a newer version * - * @param bool $force Force check + * @param bool $force Force check + * @param int $interval Interval used for update checks */ public static function check($force = false, $interval = null) { diff --git a/core/Url.php b/core/Url.php index b0e74f0067..50d7f32cd0 100644 --- a/core/Url.php +++ b/core/Url.php @@ -160,10 +160,10 @@ class Piwik_Url /** * Validate "Host" (untrusted user input) * - * @param string|false $host Contents of Host: header from Request. If false, gets the - * value from the request. + * @param string|bool $host Contents of Host: header from Request. If false, gets the + * value from the request. * - * @return boolean True if valid; false otherwise + * @return bool True if valid; false otherwise */ static public function isValidHost($host = false) { @@ -215,6 +215,7 @@ class Piwik_Url * * @static * @param $host string|array + * @return bool */ public static function saveTrustedHostnameInConfig($host) { @@ -232,7 +233,9 @@ class Piwik_Url $general['trusted_hosts'] = $host; Piwik_Config::getInstance()->General = $general; Piwik_Config::getInstance()->forceSave(); + return true; } + return false; } /** diff --git a/core/ViewDataTable.php b/core/ViewDataTable.php index 81e2ff6805..5c165121b0 100644 --- a/core/ViewDataTable.php +++ b/core/ViewDataTable.php @@ -1366,7 +1366,9 @@ abstract class Piwik_ViewDataTable /** * Sets a custom URL to use to reference this report. * - * @param string $url + * @param string $module + * @param string $action + * @param array $queryParams */ public function setReportUrl($module, $action, $queryParams = array()) { @@ -1431,6 +1433,7 @@ abstract class Piwik_ViewDataTable * @param string $module * @param string $action * @param array $queryParams + * @return string */ private function getBaseReportUrl($module, $action, $queryParams = array()) { diff --git a/core/Visualization/Cloud.php b/core/Visualization/Cloud.php index bf7a2227ee..c00c088e39 100644 --- a/core/Visualization/Cloud.php +++ b/core/Visualization/Cloud.php @@ -99,7 +99,9 @@ class Piwik_Visualization_Cloud implements Piwik_View_Interface /** * Get the class range using a percentage * - * @return int $class + * @param $percent + * + * @return int class */ protected function getClassFromPercent($percent) { diff --git a/plugins/LanguagesManager/LanguagesManager.php b/plugins/LanguagesManager/LanguagesManager.php index 29c900a8eb..c4b57386c8 100644 --- a/plugins/LanguagesManager/LanguagesManager.php +++ b/plugins/LanguagesManager/LanguagesManager.php @@ -60,8 +60,6 @@ class Piwik_LanguagesManager extends Piwik_Plugin /** * Show styled language selection drop-down list - * - * @param string $url The form action. Default is to save language. */ function showLanguagesSelector() { |