From 01c63d6e32f1a77b232c4bab96be3f2cd3463074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20M=C3=BCller?= Date: Fri, 16 Oct 2015 16:30:26 +0200 Subject: [PATCH] fixed some PHPDocs removed my prior changes to the code behaviour removed errorous PHPDocs fixed some PHPDocs removed my prior changes to the code behaviour removed errorous PHPDocs --- modules/cms/classes/CmsException.php | 2 +- modules/cms/classes/CmsObject.php | 10 +++++----- modules/cms/classes/CmsObjectCollection.php | 2 ++ modules/cms/classes/CodeParser.php | 8 ++++---- modules/cms/classes/ComponentBase.php | 6 ++++-- modules/cms/classes/Controller.php | 20 ++++++++++++++------ modules/cms/classes/MediaLibraryItem.php | 10 ++++++++++ modules/cms/classes/Page.php | 2 +- modules/cms/classes/Partial.php | 2 +- modules/cms/classes/UnknownComponent.php | 3 +++ modules/cms/classes/ViewBag.php | 15 +++++++++++++++ 11 files changed, 60 insertions(+), 20 deletions(-) diff --git a/modules/cms/classes/CmsException.php b/modules/cms/classes/CmsException.php index 82b47e9e4..5f30cda5d 100644 --- a/modules/cms/classes/CmsException.php +++ b/modules/cms/classes/CmsException.php @@ -194,7 +194,7 @@ class CmsException extends ApplicationException * Override properties of an exception specific to the Twig section * of a CMS object. * @param \Exception $exception The exception to modify. - * @return void + * @return bool */ protected function processTwig(Exception $exception) { diff --git a/modules/cms/classes/CmsObject.php b/modules/cms/classes/CmsObject.php index 131bc0542..8b6bfccaf 100644 --- a/modules/cms/classes/CmsObject.php +++ b/modules/cms/classes/CmsObject.php @@ -74,7 +74,7 @@ class CmsObject implements ArrayAccess /** * Loads the object from a cache. * This method is used by the CMS in the runtime. If the cache is not found, it is created. - * @param \Cms\Classes\Theme $theme Specifies the theme the object belongs to. + * @param $theme Specifies the theme the object belongs to. * @param string $fileName Specifies the file name, with the extension. * @return mixed Returns a CMS object instance or null if the object wasn't found. */ @@ -149,7 +149,7 @@ class CmsObject implements ArrayAccess /** * Loads the object from a file. * This method is used in the CMS back-end. It doesn't use any caching. - * @param \Cms\Classes\Theme $theme Specifies the theme the object belongs to. + * @param $theme Specifies the theme the object belongs to. * @param string $fileName Specifies the file name, with the extension. * The file name can contain only alphanumeric symbols, dashes and dots. * @return mixed Returns a CMS object instance or null if the object wasn't found. @@ -446,7 +446,7 @@ class CmsObject implements ArrayAccess /** * Returns the absolute file path. - * @param \Cms\Classes\Theme $theme Specifies a theme the file belongs to. + * @param $theme Specifies a theme the file belongs to. * @param string$fileName Specifies the file name to return the path to. * @return string */ @@ -458,7 +458,7 @@ class CmsObject implements ArrayAccess /** * Implements the getter functionality. * @param string $name - * @return void + * @return null|string */ public function __get($name) { @@ -473,7 +473,7 @@ class CmsObject implements ArrayAccess /** * Determine if an attribute exists on the object. * @param string $key - * @return void + * @return bool */ public function __isset($key) { diff --git a/modules/cms/classes/CmsObjectCollection.php b/modules/cms/classes/CmsObjectCollection.php index b79974ec1..459908a21 100644 --- a/modules/cms/classes/CmsObjectCollection.php +++ b/modules/cms/classes/CmsObjectCollection.php @@ -59,8 +59,10 @@ class CmsObjectCollection extends CollectionBase /** * Returns objects whose component properties match the supplied value. + * @param mixed $components * @param string $property * @param string $value + * @param bool $strict * @return static */ public function whereComponent($components, $property, $value, $strict = false) diff --git a/modules/cms/classes/CodeParser.php b/modules/cms/classes/CodeParser.php index f381e2f37..8f172b5d8 100644 --- a/modules/cms/classes/CodeParser.php +++ b/modules/cms/classes/CodeParser.php @@ -15,7 +15,7 @@ use SystemException; class CodeParser { /** - * @var Cms\Classes\CmsCompoundObject A reference to the CMS object being parsed. + * @var \Cms\Classes\CmsCompoundObject A reference to the CMS object being parsed. */ protected $object; @@ -141,9 +141,9 @@ class CodeParser /** * Runs the object's PHP file and returns the corresponding object. - * @param Cms\Classes\Page $page Specifies the CMS page. - * @param Cms\Classes\Layout $layout Specifies the CMS layout. - * @param Cms\Classes\Controller $controller Specifies the CMS controller. + * @param \Cms\Classes\Page $page Specifies the CMS page. + * @param \Cms\Classes\Layout $layout Specifies the CMS layout. + * @param \Cms\Classes\Controller $controller Specifies the CMS controller. * @return mixed */ public function source($page, $layout, $controller) diff --git a/modules/cms/classes/ComponentBase.php b/modules/cms/classes/ComponentBase.php index 9d65ebaf5..a4507b963 100644 --- a/modules/cms/classes/ComponentBase.php +++ b/modules/cms/classes/ComponentBase.php @@ -64,12 +64,12 @@ abstract class ComponentBase extends Extendable protected $dirName; /** - * @var Cms\Classes\Controller Controller object. + * @var \Cms\Classes\Controller Controller object. */ protected $controller; /** - * @var Cms\Classes\PageCode Page object object. + * @var \Cms\Classes\PageCode Page object object. */ protected $page; @@ -81,6 +81,8 @@ abstract class ComponentBase extends Extendable /** * Component constructor. Takes in the page or layout code section object * and properties set by the page or layout. + * @param null|CodeBase $cmsObject + * @param array $properties */ public function __construct(CodeBase $cmsObject = null, $properties = []) { diff --git a/modules/cms/classes/Controller.php b/modules/cms/classes/Controller.php index fc4a94bb2..01a27602a 100644 --- a/modules/cms/classes/Controller.php +++ b/modules/cms/classes/Controller.php @@ -670,6 +670,7 @@ class Controller /** * Tries to find and run an AJAX handler in the page, layout, components and plugins. * The method stops as soon as the handler is found. + * @param string $handler name of the ajax handler * @return boolean Returns true if the handler was found. Returns false otherwise. */ protected function runAjaxHandler($handler) @@ -743,7 +744,7 @@ class Controller /** * Renders a requested partial. * The framework uses this method internally. - * @param string $partial The view to load. + * @param string $name The view to load. * @param array $parameters Parameter variables to pass to the view. * @param bool $throwException Throw an exception if the partial is not found. * @return mixed Partial contents or false if not throwing an exception. @@ -954,6 +955,8 @@ class Controller /** * Renders a component's default content. + * @param $name + * @param array $parameters * @return string Returns the component default contents. */ public function renderComponent($name, $parameters = []) @@ -976,7 +979,7 @@ class Controller /** * Sets the status code for the current web response. * @param int $code Status code - * @return \Cms\Classes\Controller $this + * @return self */ public function setStatusCode($code) { @@ -1018,7 +1021,7 @@ class Controller /** * Returns the Twig loader. - * @return Cms\Twig\Loader + * @return \Cms\Twig\Loader */ public function getLoader() { @@ -1114,6 +1117,9 @@ class Controller /** * Looks up the current page URL with supplied parameters and route persistence. + * @param array $parameters + * @param bool $routePersistence + * @return null|string */ public function currentPageUrl($parameters = [], $routePersistence = true) { @@ -1160,8 +1166,8 @@ class Controller /** * Returns a routing parameter. - * @param string Routing parameter name. - * @param string Default to use if none is found. + * @param string $name Routing parameter name. + * @param string $default Default to use if none is found. * @return string */ public function param($name, $default = null) @@ -1209,6 +1215,7 @@ class Controller /** * Searches the layout and page components by an alias + * @param $name * @return ComponentBase The component object, if found */ public function findComponentByName($name) @@ -1231,6 +1238,7 @@ class Controller /** * Searches the layout and page components by an AJAX handler + * @param string $handler * @return ComponentBase The component object, if found */ public function findComponentByHandler($handler) @@ -1252,6 +1260,7 @@ class Controller /** * Searches the layout and page components by a partial file + * @param string $partial * @return ComponentBase The component object, if found */ public function findComponentByPartial($partial) @@ -1296,7 +1305,6 @@ class Controller * The property values should be defined as {{ param }}. * @param ComponentBase $component The component object. * @param array $parameters Specifies the partial parameters. - * @return Returns updated properties. */ protected function setComponentPropertiesFromParams($component, $parameters = []) { diff --git a/modules/cms/classes/MediaLibraryItem.php b/modules/cms/classes/MediaLibraryItem.php index 062df3ce6..2631deee2 100644 --- a/modules/cms/classes/MediaLibraryItem.php +++ b/modules/cms/classes/MediaLibraryItem.php @@ -65,6 +65,13 @@ class MediaLibraryItem protected static $videoExtensions; protected static $audioExtensions; + /** + * @param string $path + * @param int $size + * @param int $lastModified + * @param string $type + * @param string $publicUrl + */ public function __construct($path, $size, $lastModified, $type, $publicUrl) { $this->path = $path; @@ -74,6 +81,9 @@ class MediaLibraryItem $this->publicUrl = $publicUrl; } + /** + * @return bool + */ public function isFile() { return $this->type == self::TYPE_FILE; diff --git a/modules/cms/classes/Page.php b/modules/cms/classes/Page.php index 85c76b4e3..b9797f5d2 100644 --- a/modules/cms/classes/Page.php +++ b/modules/cms/classes/Page.php @@ -166,8 +166,8 @@ class Page extends CmsCompoundObject * - items - an array of arrays with the same keys (url, isActive, items) + the title key. * The items array should be added only if the $item's $nesting property value is TRUE. * @param \RainLab\Pages\Classes\MenuItem $item Specifies the menu item. - * @param \Cms\Classes\Theme $theme Specifies the current theme. * @param string $url Specifies the current page URL, normalized, in lower case + * @param \Cms\Classes\Theme $theme Specifies the current theme. * The URL is specified relative to the website root, it includes the subdirectory name, if any. * @return mixed Returns an array. Returns null if the item cannot be resolved. */ diff --git a/modules/cms/classes/Partial.php b/modules/cms/classes/Partial.php index 690319e60..0b422d405 100644 --- a/modules/cms/classes/Partial.php +++ b/modules/cms/classes/Partial.php @@ -20,7 +20,7 @@ class Partial extends CmsCompoundObject /** * Returns name of a PHP class to us a parent for the PHP class created for the object's PHP section. - * @return mixed Returns the class name or null. + * @return string Returns the class name. */ public function getCodeClassParent() { diff --git a/modules/cms/classes/UnknownComponent.php b/modules/cms/classes/UnknownComponent.php index 7e9eaf23b..a30d4354f 100644 --- a/modules/cms/classes/UnknownComponent.php +++ b/modules/cms/classes/UnknownComponent.php @@ -19,6 +19,9 @@ class UnknownComponent extends ComponentBase parent::__construct($cmsObject, $properties); } + /** + * @return array + */ public function componentDetails() { return [ diff --git a/modules/cms/classes/ViewBag.php b/modules/cms/classes/ViewBag.php index 26c451212..caac972e1 100644 --- a/modules/cms/classes/ViewBag.php +++ b/modules/cms/classes/ViewBag.php @@ -13,6 +13,9 @@ class ViewBag extends ComponentBase { public $isHidden = true; + /** + * @return array + */ public function componentDetails() { return [ @@ -21,11 +24,20 @@ class ViewBag extends ComponentBase ]; } + /** + * @param array $properties + * @return array + */ public function validateProperties(array $properties) { return $properties; } + /** + * @param string $method + * @param array $parameters + * @return mixed + */ public function __call($method, $parameters) { if (array_key_exists($method, $this->properties) && !method_exists($this, $method)) { @@ -35,6 +47,9 @@ class ViewBag extends ComponentBase return parent::__call($method, $parameters); } + /** + * @return array + */ public function defineProperties() { $result = [];