diff options
author | sgiehl <stefan@piwik.org> | 2013-08-02 21:52:14 +0400 |
---|---|---|
committer | sgiehl <stefan@piwik.org> | 2013-08-02 21:52:14 +0400 |
commit | bbb9c0e10868fdf96e1c53f8f7dd71a14e0abd53 (patch) | |
tree | 80b00ddcb5bca16f6762e9ca088e76aeead61ebb | |
parent | 54e0234ab1a1865d1d2aebd1aa59dc667b9f29b5 (diff) |
fixed some doc blocks/namespaces
-rw-r--r-- | core/Access.php | 3 | ||||
-rw-r--r-- | core/Controller.php | 1 | ||||
-rw-r--r-- | core/Log/ScreenFormatter.php | 18 | ||||
-rw-r--r-- | core/Piwik.php | 11 | ||||
-rw-r--r-- | core/PluginsManager.php | 2 | ||||
-rw-r--r-- | core/ScheduledTime.php | 5 | ||||
-rw-r--r-- | core/Timer.php | 28 | ||||
-rw-r--r-- | core/Tracker.php | 8 | ||||
-rw-r--r-- | core/Tracker/Visit.php | 16 | ||||
-rw-r--r-- | core/Tracker/VisitExcluded.php | 5 | ||||
-rw-r--r-- | core/Updates.php | 2 | ||||
-rw-r--r-- | core/ViewDataTable.php | 5 | ||||
-rw-r--r-- | core/ViewDataTable/Cloud.php | 8 | ||||
-rw-r--r-- | core/ViewDataTable/GenerateGraphHTML/ChartPie.php | 5 | ||||
-rw-r--r-- | core/ViewDataTable/GenerateGraphHTML/ChartVerticalBar.php | 5 | ||||
-rw-r--r-- | core/ViewDataTable/HtmlTable/AllColumns.php | 9 | ||||
-rw-r--r-- | core/ViewDataTable/Sparkline.php | 5 |
17 files changed, 122 insertions, 14 deletions
diff --git a/core/Access.php b/core/Access.php index 7f1f89c616..0f8d24f77b 100644 --- a/core/Access.php +++ b/core/Access.php @@ -13,6 +13,7 @@ namespace Piwik; use Piwik\Config; use Piwik\Common; use Piwik\Auth; +use Piwik\Site; use Piwik\Db; /** @@ -421,7 +422,7 @@ class Access $idSites = $this->getSitesIdWithAtLeastViewAccess(); } - $idSites = \Piwik\Site::getIdSitesFromIdSitesString($idSites); + $idSites = Site::getIdSitesFromIdSitesString($idSites); if (empty($idSites)) { throw new NoAccessException("The parameter 'idSite=' is missing from the request."); } diff --git a/core/Controller.php b/core/Controller.php index b262c698a9..0dfcec0d04 100644 --- a/core/Controller.php +++ b/core/Controller.php @@ -591,7 +591,6 @@ abstract class Controller $columns = Common::getRequestVar('columns', false); if ($columns !== false) { $columns = Piwik::getArrayFromApiParameter($columns); - $firstColumn = $columns[0]; } else { // default columns $firstColumn = isset($view->period) && $view->period == 'day' ? $defaultMetricDay : $defaultMetric; diff --git a/core/Log/ScreenFormatter.php b/core/Log/ScreenFormatter.php index 550ad628b0..cc8778beeb 100644 --- a/core/Log/ScreenFormatter.php +++ b/core/Log/ScreenFormatter.php @@ -17,17 +17,35 @@ use Piwik\Common; */ class ScreenFormatter implements \Zend_Log_Formatter_Interface { + /** + * Returns the formatted event array + * + * @param array $event + * @return array + */ function formatEvent($event) { // no injection in error messages, backtrace when displayed on screen return array_map(array('Piwik\Common', 'sanitizeInputValue'), $event); } + /** + * Returns the formatted String + * + * @param string $string + * @return string + */ function format($string) { return self::getFormattedString($string); } + /** + * Returns the formatted String + * + * @param string $string + * @return string + */ static public function getFormattedString($string) { if (!Common::isPhpCliMode()) { diff --git a/core/Piwik.php b/core/Piwik.php index acdcd8d6ff..80f1b92a94 100644 --- a/core/Piwik.php +++ b/core/Piwik.php @@ -12,6 +12,7 @@ namespace Piwik; use Exception; use Piwik\Access; +use Piwik\NoAccessException; use Piwik\AssetManager; use Piwik\Common; use Piwik\Config; @@ -1642,7 +1643,7 @@ class Piwik * Check that current user is either the specified user or the superuser * * @param string $theUser - * @throws \Piwik\NoAccessException if the user is neither the super user nor the user $theUser + * @throws NoAccessException if the user is neither the super user nor the user $theUser */ static public function checkUserIsSuperUserOrTheUser($theUser) { @@ -1651,8 +1652,8 @@ class Piwik // or to the super user Piwik::checkUserIsSuperUser(); } - } catch (\Piwik\NoAccessException $e) { - throw new \Piwik\NoAccessException(Piwik_Translate('General_ExceptionCheckUserIsSuperUserOrTheUser', array($theUser))); + } catch (NoAccessException $e) { + throw new NoAccessException(Piwik_Translate('General_ExceptionCheckUserIsSuperUserOrTheUser', array($theUser))); } } @@ -1684,12 +1685,12 @@ class Piwik /** * Checks if user is not the anonymous user. * - * @throws \Piwik\NoAccessException if user is anonymous. + * @throws NoAccessException if user is anonymous. */ static public function checkUserIsNotAnonymous() { if (self::isUserIsAnonymous()) { - throw new \Piwik\NoAccessException(Piwik_Translate('General_YouMustBeLoggedIn')); + throw new NoAccessException(Piwik_Translate('General_YouMustBeLoggedIn')); } } diff --git a/core/PluginsManager.php b/core/PluginsManager.php index 0626db36a3..e9b7ed2b47 100644 --- a/core/PluginsManager.php +++ b/core/PluginsManager.php @@ -642,7 +642,7 @@ class PluginsManager $plugins = Config::getInstance()->Plugins['Plugins']; foreach ($plugins as $pluginName) { // if a plugin is listed in the config, but is not loaded, it does not exist in the folder - if (!\Piwik\PluginsManager::getInstance()->isPluginLoaded($pluginName)) { + if (!self::getInstance()->isPluginLoaded($pluginName)) { $missingPlugins[] = $pluginName; } } diff --git a/core/ScheduledTime.php b/core/ScheduledTime.php index af6c82c946..ec4d3fcab8 100644 --- a/core/ScheduledTime.php +++ b/core/ScheduledTime.php @@ -48,6 +48,11 @@ abstract class ScheduledTime */ public $day = 1; + /** + * @param $period + * @return Daily|Monthly|Weekly + * @throws \Exception + */ static public function getScheduledTimeForPeriod($period) { switch ($period) { diff --git a/core/Timer.php b/core/Timer.php index d3f1e29d79..c1d17a8020 100644 --- a/core/Timer.php +++ b/core/Timer.php @@ -21,43 +21,71 @@ class Timer private $timerStart; private $memoryStart; + /** + * @return \Piwik\Timer + */ public function __construct() { $this->init(); } + /** + * @return void + */ public function init() { $this->timerStart = $this->getMicrotime(); $this->memoryStart = $this->getMemoryUsage(); } + /** + * @param int $decimals + * @return string + */ public function getTime($decimals = 3) { return number_format($this->getMicrotime() - $this->timerStart, $decimals, '.', ''); } + /** + * @param int $decimals + * @return string + */ public function getTimeMs($decimals = 3) { return number_format(1000 * ($this->getMicrotime() - $this->timerStart), $decimals, '.', ''); } + /** + * @return string + */ public function getMemoryLeak() { return "Memory delta: " . Piwik::getPrettySizeFromBytes($this->getMemoryUsage() - $this->memoryStart); } + /** + * @return string + */ public function __toString() { return "Time elapsed: " . $this->getTime() . "s"; } + /** + * @return float + */ private function getMicrotime() { list($micro_seconds, $seconds) = explode(" ", microtime()); return ((float)$micro_seconds + (float)$seconds); } + /** + * Returns current memory usage, if available + * + * @return int + */ private function getMemoryUsage() { if (function_exists('memory_get_usage')) { diff --git a/core/Tracker.php b/core/Tracker.php index c485da36fc..bdb454d030 100644 --- a/core/Tracker.php +++ b/core/Tracker.php @@ -135,11 +135,17 @@ class Tracker return self::$pluginsNotToLoad; } + /** + * @return array + */ static public function getPluginsToLoad() { return self::$pluginsToLoad; } + /** + * @param array $plugins + */ static public function setPluginsToLoad($plugins) { self::$pluginsToLoad = $plugins; @@ -364,7 +370,7 @@ class Tracker Piwik::createDatabaseObject(); } - $pluginsManager = \Piwik\PluginsManager::getInstance(); + $pluginsManager = PluginsManager::getInstance(); $pluginsToLoad = Config::getInstance()->Plugins['Plugins']; $pluginsForcedNotToLoad = Tracker::getPluginsNotToLoad(); $pluginsToLoad = array_diff($pluginsToLoad, $pluginsForcedNotToLoad); diff --git a/core/Tracker/Visit.php b/core/Tracker/Visit.php index 7a791c41a3..0b478836ea 100644 --- a/core/Tracker/Visit.php +++ b/core/Tracker/Visit.php @@ -16,9 +16,16 @@ namespace Piwik\Tracker; */ interface VisitInterface { - function setRequest(Request $request); + /** + * @param Request $request + * @return void + */ + public function setRequest(Request $request); - function handle(); + /** + * @return void + */ + public function handle(); } use Piwik\Config; @@ -68,7 +75,10 @@ class Visit implements Tracker\VisitInterface protected $visitorCustomVariables = array(); protected $visitorKnown; - function setRequest(Request $request) + /** + * @param Request $request + */ + public function setRequest(Request $request) { $this->request = $request; } diff --git a/core/Tracker/VisitExcluded.php b/core/Tracker/VisitExcluded.php index c7a43ddda6..3ee3234f48 100644 --- a/core/Tracker/VisitExcluded.php +++ b/core/Tracker/VisitExcluded.php @@ -21,6 +21,11 @@ use Piwik\Tracker\Request; */ class VisitExcluded { + /** + * @param Request $request + * @param bool|string $ip + * @param bool|string $userAgent + */ public function __construct(Request $request, $ip = false, $userAgent = false) { if ($ip === false) { diff --git a/core/Updates.php b/core/Updates.php index 9f5e7ab1ee..e54ff50569 100644 --- a/core/Updates.php +++ b/core/Updates.php @@ -45,6 +45,8 @@ abstract class Updates /** * Tell the updater that this is a major update. * Leads to a more visible notice. + * + * @return bool */ static function isMajorUpdate() { diff --git a/core/ViewDataTable.php b/core/ViewDataTable.php index c2f7dcc7e8..dd578d962a 100644 --- a/core/ViewDataTable.php +++ b/core/ViewDataTable.php @@ -24,6 +24,7 @@ use Piwik\Site; use Piwik\ViewDataTable\Properties; use Piwik\ViewDataTable\VisualizationPropertiesProxy; use Piwik_API_API; +use Piwik\PluginsManager; /** * This class is used to load (from the API) and customize the output of a given DataTable. @@ -1204,11 +1205,11 @@ class ViewDataTable protected function overrideViewProperties() { - if (!\Piwik\PluginsManager::getInstance()->isPluginActivated('Goals')) { + if (!PluginsManager::getInstance()->isPluginActivated('Goals')) { $this->viewProperties['show_goals'] = false; } - if (!\Piwik\PluginsManager::getInstance()->isPluginLoaded('Annotations')) { + if (!PluginsManager::getInstance()->isPluginLoaded('Annotations')) { $this->viewProperties['hide_annotations_view'] = true; } diff --git a/core/ViewDataTable/Cloud.php b/core/ViewDataTable/Cloud.php index 60488ff8df..653cc8c022 100644 --- a/core/ViewDataTable/Cloud.php +++ b/core/ViewDataTable/Cloud.php @@ -25,11 +25,19 @@ use Piwik\Visualization; */ class Cloud extends ViewDataTable { + /** + * @param bool $bool + */ public function setDisplayLogoInTagCloud($bool) { $this->viewProperties['display_logo_instead_of_label'] = $bool; } + /** + * Returns the dataTable id for the view + * + * @return string + */ protected function getViewDataTableId() { return 'cloud'; diff --git a/core/ViewDataTable/GenerateGraphHTML/ChartPie.php b/core/ViewDataTable/GenerateGraphHTML/ChartPie.php index de5e541b33..d6801503ef 100644 --- a/core/ViewDataTable/GenerateGraphHTML/ChartPie.php +++ b/core/ViewDataTable/GenerateGraphHTML/ChartPie.php @@ -28,6 +28,11 @@ class ChartPie extends GenerateGraphHTML $this->viewProperties['allow_multi_select_series_picker'] = false; } + /** + * Returns dataTable id for view + * + * @return string + */ protected function getViewDataTableId() { return 'graphPie'; diff --git a/core/ViewDataTable/GenerateGraphHTML/ChartVerticalBar.php b/core/ViewDataTable/GenerateGraphHTML/ChartVerticalBar.php index 78d9f3c3a3..6eae9c0e58 100644 --- a/core/ViewDataTable/GenerateGraphHTML/ChartVerticalBar.php +++ b/core/ViewDataTable/GenerateGraphHTML/ChartVerticalBar.php @@ -28,6 +28,11 @@ class ChartVerticalBar extends GenerateGraphHTML $this->viewProperties['graph_limit'] = 6; } + /** + * Returns dataTable id for view + * + * @return string + */ protected function getViewDataTableId() { return 'graphVerticalBar'; diff --git a/core/ViewDataTable/HtmlTable/AllColumns.php b/core/ViewDataTable/HtmlTable/AllColumns.php index 9b29f72b75..c54ad5818a 100644 --- a/core/ViewDataTable/HtmlTable/AllColumns.php +++ b/core/ViewDataTable/HtmlTable/AllColumns.php @@ -19,6 +19,11 @@ use Piwik\ViewDataTable\HtmlTable; */ class AllColumns extends HtmlTable { + /** + * Returns dataTable id for view + * + * @return string + */ protected function getViewDataTableId() { return 'tableAllColumns'; @@ -63,6 +68,10 @@ class AllColumns extends HtmlTable return true; } + /** + * Returns default css class for dataTable + * @return string + */ public function getDefaultDataTableCssClass() { return 'dataTableAllColumns'; diff --git a/core/ViewDataTable/Sparkline.php b/core/ViewDataTable/Sparkline.php index 34adead2f7..02988a86dd 100644 --- a/core/ViewDataTable/Sparkline.php +++ b/core/ViewDataTable/Sparkline.php @@ -23,6 +23,11 @@ use Piwik\ViewDataTable; */ class Sparkline extends ViewDataTable { + /** + * Returns dataTable id for view + * + * @return string + */ protected function getViewDataTableId() { return 'sparkline'; |