From 01c44e9002d03f58c9a5271c6256096de3273eb5 Mon Sep 17 00:00:00 2001 From: Steve Clay Date: Mon, 9 Apr 2012 15:06:33 -0400 Subject: More PHPDoc comments and @var declarations to help IDE comprehension --- lib/videolist.php | 8 +++++ start.php | 52 +++++++++++++++++++--------- upgrades/2012022501.php | 1 + views/default/icon/object/videolist_item.php | 1 + views/default/object/videolist_item.php | 1 + 5 files changed, 47 insertions(+), 16 deletions(-) diff --git a/lib/videolist.php b/lib/videolist.php index 2dfc7d8fc..96a2c6335 100644 --- a/lib/videolist.php +++ b/lib/videolist.php @@ -6,6 +6,10 @@ foreach(explode(', ', VIDEOLIST_SUPPORTED_PLATFORMS) as $videotype){ include(elgg_get_plugins_path()."videolist/lib/$videotype.php"); } +/** + * @param string $url + * @return array + */ function videolist_parseurl($url){ foreach(explode(', ', VIDEOLIST_SUPPORTED_PLATFORMS) as $videotype){ if (is_callable("videolist_parseurl_$videotype")){ @@ -17,6 +21,10 @@ function videolist_parseurl($url){ return array(); } +/** + * @param array $parsed + * @return array + */ function videolist_get_data($parsed) { $videotype = $parsed['videotype']; $video_id = $parsed['video_id']; diff --git a/start.php b/start.php index 07ec618a0..d764a78c9 100644 --- a/start.php +++ b/start.php @@ -128,6 +128,12 @@ function videolist_page_handler($page) { /** * Add a menu item to the user ownerblock + * + * @param string $hook + * @param string $type + * @param array $return + * @param array $params + * @return array */ function videolist_owner_block_menu($hook, $type, $return, $params) { if (elgg_instanceof($params['entity'], 'user')) { @@ -145,6 +151,10 @@ function videolist_owner_block_menu($hook, $type, $return, $params) { return $return; } +/** + * @param ElggObject $videolist_item + * @return string + */ function videolist_url($videolist_item) { $guid = $videolist_item->guid; $title = elgg_get_friendly_title($videolist_item->title); @@ -154,6 +164,9 @@ function videolist_url($videolist_item) { /** * Event handler for videolist * + * @param string $event + * @param string $object_type + * @param ElggObject $object */ function videolist_object_notifications($event, $object_type, $object) { static $flag; @@ -177,11 +190,11 @@ function videolist_object_notifications($event, $object_type, $object) { * Intercepts the notification on an event of new video being created and prevents a notification from going out * (because one will be sent on the annotation) * - * @param unknown_type $hook - * @param unknown_type $entity_type - * @param unknown_type $returnvalue - * @param unknown_type $params - * @return unknown + * @param string $hook + * @param string $entity_type + * @param array $returnvalue + * @param array $params + * @return bool */ function videolist_object_notifications_intercept($hook, $entity_type, $returnvalue, $params) { if (isset($params)) { @@ -198,10 +211,11 @@ function videolist_object_notifications_intercept($hook, $entity_type, $returnva /** * Register videolist as an embed type. * - * @param unknown_type $hook - * @param unknown_type $type - * @param unknown_type $value - * @param unknown_type $params + * @param string $hook + * @param string $type + * @param array $value + * @param array $params + * @return array */ function videolist_embed_get_sections($hook, $type, $value, $params) { $value['videolist'] = array( @@ -216,10 +230,11 @@ function videolist_embed_get_sections($hook, $type, $value, $params) { /** * Return a list of videos for embedding * - * @param unknown_type $hook - * @param unknown_type $type - * @param unknown_type $value - * @param unknown_type $params + * @param string $hook + * @param string $type + * @param array $value + * @param array $params + * @return array */ function videolist_embed_get_items($hook, $type, $value, $params) { $options = array( @@ -245,13 +260,18 @@ function videolist_embed_get_items($hook, $type, $value, $params) { /** * Override the default entity icon for videoslist items * + * @param string $hook + * @param string $type + * @param string $returnvalue + * @param array $params * @return string Relative URL */ function videolist_icon_url_override($hook, $type, $returnvalue, $params) { $videolist_item = $params['entity']; - $size = $params['size']; - - if($videolist_item->getSubtype() != 'videolist_item'){ + /* @var ElggObject $videolist_item */ + $size = $params['size']; + + if($videolist_item->getSubtype() != 'videolist_item'){ return $returnvalue; } diff --git a/upgrades/2012022501.php b/upgrades/2012022501.php index 815e10b62..50102e875 100644 --- a/upgrades/2012022501.php +++ b/upgrades/2012022501.php @@ -29,6 +29,7 @@ foreach ($items as $item) { * Downloads the thumbnail and saves into data folder * * @param ElggObject $item + * @return bool */ function videolist_2012022501($item) { diff --git a/views/default/icon/object/videolist_item.php b/views/default/icon/object/videolist_item.php index 38b805021..24a5b5fe8 100644 --- a/views/default/icon/object/videolist_item.php +++ b/views/default/icon/object/videolist_item.php @@ -11,6 +11,7 @@ */ $entity = $vars['entity']; +/* @var ElggObject $entity */ $sizes = array('small', 'medium', 'large', 'tiny', 'master', 'topbar'); $img_width = array('tiny' => 25, 'small' => 40, 'medium' => 100, 'large' => 200); diff --git a/views/default/object/videolist_item.php b/views/default/object/videolist_item.php index 6ed284a43..e30d9d95b 100644 --- a/views/default/object/videolist_item.php +++ b/views/default/object/videolist_item.php @@ -7,6 +7,7 @@ $full = elgg_extract('full_view', $vars, FALSE); $entity = elgg_extract('entity', $vars, FALSE); +/* @var ElggObject $entity */ if (!$entity) { return TRUE; -- cgit v1.2.3