Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit 3905efe

Browse files
author
Jamie Snape
committed
Add more documentation
1 parent 52519e9 commit 3905efe

File tree

93 files changed

+1485
-558
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+1485
-558
lines changed

core/controllers/ApikeyController.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,20 @@
2121
/** Apikey controller for Web Api */
2222
class ApikeyController extends AppController
2323
{
24+
/** @var array */
2425
public $_models = array('User', 'Userapi');
26+
27+
/** @var array */
2528
public $_forms = array('Apikey');
29+
30+
/** @var array */
2631
public $_components = array('Date');
2732

2833
/**
2934
* Configuration action for a user's api keys
3035
*
3136
* @param userId The id of the user to display
37+
* @throws Zend_Exception
3238
*/
3339
public function usertabAction()
3440
{

core/controllers/BrowseController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@ public function getelementinfoAction()
491491
* @param type The type of the resource: (folder | item)
492492
* @return JSON object with the "policy" field set to the max policy on the resource.
493493
* Throws exception if the user has no access to the resource
494+
* @throws Zend_Exception
494495
*/
495496
public function getmaxpolicyAction()
496497
{

core/controllers/CommunityController.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,7 @@ public function deleteAction()
467467
* Dialog for inviting a user to a community
468468
*
469469
* @param communityId Id of the community to invite into. Write permission required.
470+
* @throws Zend_Exception
470471
*/
471472
public function invitationAction()
472473
{
@@ -536,6 +537,7 @@ public function addusertogroupAction()
536537
* @param [userId] Id of the user to invite. If not passed, must pass email parameter
537538
* @param [email] Email of the user to invite. If not passed, must pass userId parameter.
538539
* If no such user exists, sends an email inviting the user to register and join the group.
540+
* @throws Zend_Exception
539541
*/
540542
public function sendinvitationAction()
541543
{
@@ -839,6 +841,7 @@ public function removeuserfromgroupAction()
839841
* Requires moderator or admin permission on the community
840842
*
841843
* @param communityId The id of the community
844+
* @throws Zend_Exception
842845
*/
843846
public function selectgroupAction()
844847
{

core/controllers/DownloadController.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@
2323
*/
2424
class DownloadController extends AppController
2525
{
26+
/** @var array */
2627
public $_models = array('Folder', 'Item', 'Community', 'User', 'Bitstream');
27-
public $_daos = array();
28+
29+
/** @var array */
2830
public $_components = array('DownloadBitstream');
2931

30-
/** index
32+
/**
33+
* Index action.
3134
*
3235
* @param folders = 12-13 (will download a zip of the folder 12 and 13, recursively)
3336
* @param folders = 12, 1-13, 1 (will download a zip of the folder 12 and 13, recursively) // Need testing
@@ -37,6 +40,7 @@ class DownloadController extends AppController
3740
* @param bitstream = 1 (will download related bitstream)
3841
* @param offset The offset in bytes if downloading a bitstream (defaults to 0)
3942
* @param name Alternate filename when downloading a bitstream (defaults to bitstream name)
43+
* @throws Zend_Exception
4044
*/
4145
public function indexAction()
4246
{
@@ -223,6 +227,8 @@ public function indexAction()
223227

224228
/**
225229
* Ajax action for determining what action to take based on the size of the requested download.
230+
*
231+
* @throws Zend_Exception
226232
*/
227233
public function checksizeAction()
228234
{
@@ -288,6 +294,7 @@ public function checksizeAction()
288294
* download/item/<item_id>/...
289295
* Any extra parameters are ignored and can be used to force clients like wget to download to the correct filename
290296
* if the content-disposition header is ignored by the user agent.
297+
* @throws Zend_Exception
291298
*/
292299
public function itemAction()
293300
{
@@ -304,6 +311,8 @@ public function itemAction()
304311
* download/folder/<folder_id>/...
305312
* Any extra parameters are ignored and can be used to force clients like wget to download to the correct filename
306313
* if the content-disposition header is ignored by the user agent.
314+
*
315+
* @throws Zend_Exception
307316
*/
308317
public function folderAction()
309318
{
@@ -320,6 +329,8 @@ public function folderAction()
320329
* download/bitstream/<bitstream_id>/...
321330
* Any extra parameters are ignored and can be used to force clients like wget to download to the correct filename
322331
* if the content-disposition header is ignored by the user agent.
332+
*
333+
* @throws Zend_Exception
323334
*/
324335
public function bitstreamAction()
325336
{

core/controllers/ItemController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,7 @@ public function checksharedAction()
574574
* @param metadatatype
575575
* @param element
576576
* @param qualifier
577+
* @throws Zend_Exception
577578
*/
578579
public function getmetadatavalueexistsAction()
579580
{
@@ -613,6 +614,7 @@ public function getmetadatavalueexistsAction()
613614
* otherwise the request produces no output.
614615
*
615616
* @param itemId The item whose thumbnail you wish to download
617+
* @throws Zend_Exception
616618
*/
617619
public function thumbnailAction()
618620
{

core/controllers/UserController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,6 +1199,7 @@ public function deletedialogAction()
11991199
* @param [lastName] User's last name
12001200
* @param [password] User's password
12011201
* @param [password2] User's password retyped
1202+
* @throws Zend_Exception
12021203
*/
12031204
public function emailregisterAction()
12041205
{

core/controllers/components/ApihelperComponent.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,8 @@ public function listResourcePermissions($policyStatus, $userPolicies, $groupPoli
393393
*
394394
* @param id the group to add the user to
395395
* @param user_id the user to add to the group
396-
* @return an array of (groupModel, groupDao, groupUserDao)
396+
* @return array an array of (groupModel, groupDao, groupUserDao)
397+
* @throws Exception
397398
*/
398399
public function validateGroupUserChangeParams($args)
399400
{
@@ -417,7 +418,7 @@ public function validateGroupUserChangeParams($args)
417418
$communityModel = MidasLoader::loadModel('Community');
418419
if (!$communityModel->policyCheck($group->getCommunity(), $userDao, MIDAS_POLICY_ADMIN)
419420
) {
420-
throw new Zend_Exception("Community Admin permissions required.", MIDAS_INVALID_POLICY);
421+
throw new Exception("Community Admin permissions required.", MIDAS_INVALID_POLICY);
421422
}
422423

423424
$groupUserId = $args['user_id'];
@@ -451,8 +452,9 @@ public function checkMetadataTypeOrName(&$args, &$metadataModel)
451452
* helper method to validate passed in community privacy status params and
452453
* map them to valid community privacy codes.
453454
*
454-
* @param string $privacyStatus , should be 'Private' or 'Public'
455-
* @return valid community privacy code
455+
* @param string $privacyStatus should be 'Private' or 'Public'
456+
* @return int valid community privacy code
457+
* @throws Exception
456458
*/
457459
public function getValidCommunityPrivacyCode($privacyStatus)
458460
{
@@ -472,8 +474,9 @@ public function getValidCommunityPrivacyCode($privacyStatus)
472474
* helper method to validate passed in community can join status params and
473475
* map them to valid community can join codes.
474476
*
475-
* @param string $canjoinStatus , should be 'Everyone' or 'Invitation'
476-
* @return valid community canjoin code
477+
* @param string $canjoinStatus should be 'Everyone' or 'Invitation'
478+
* @return int valid community canjoin code
479+
* @throws Exception
477480
*/
478481
public function getValidCommunityCanjoinCode($canjoinStatus)
479482
{

core/models/base/CommunityInvitationModelBase.php

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
/** ItemRevisionModelBase */
2222
class CommunityInvitationModelBase extends AppModel
2323
{
24-
/** Constructor */
24+
/** Constructor. */
2525
public function __construct()
2626
{
2727
parent::__construct();
@@ -57,11 +57,13 @@ public function __construct()
5757
}
5858

5959
/**
60-
* Create an invitation record for the user into the given group
60+
* Create an invitation record for the user into the given group.
6161
*
62-
* @param groupDao The group to invite the user to
63-
* @param userDao The user performing the invitation (typically the session user)
64-
* @param invitedUserDao The user being invited to the group
62+
* @param GroupDao $groupDao The group to invite the user to
63+
* @param UserDao $userDao The user performing the invitation (typically the session user)
64+
* @param UserDao $invitedUserDao The user being invited to the group
65+
* @return false|CommunityInvitationDao
66+
* @throws Zend_Exception
6567
*/
6668
public function createInvitation($groupDao, $userDao, $invitedUserDao)
6769
{
@@ -92,7 +94,14 @@ public function createInvitation($groupDao, $userDao, $invitedUserDao)
9294
return $invitationDao;
9395
}
9496

95-
/** is user invited */
97+
/**
98+
* Is user invited?
99+
*
100+
* @param CommunityDao $communityDao
101+
* @param UserDao $userDao
102+
* @param bool $returnDao
103+
* @return bool|CommunityInvitationDao
104+
*/
96105
public function isInvited($communityDao, $userDao, $returnDao = false)
97106
{
98107
if ($userDao == null) {
@@ -112,11 +121,18 @@ public function isInvited($communityDao, $userDao, $returnDao = false)
112121
return false;
113122
}
114123

115-
/** remove invitation */
124+
/**
125+
* Remove invitation.
126+
*
127+
* @param CommunityDao $communityDao
128+
* @param UserDao $userDao
129+
* @return bool
130+
* @throws Zend_Exception
131+
*/
116132
public function removeInvitation($communityDao, $userDao)
117133
{
118134
if ($userDao == null) {
119-
return;
135+
return false;
120136
}
121137
$invitations = $userDao->getInvitations();
122138
foreach ($invitations as $invitation) {
@@ -133,6 +149,6 @@ public function removeInvitation($communityDao, $userDao)
133149
}
134150
}
135151

136-
return;
152+
return false;
137153
}
138154
}

core/models/base/CommunityModelBase.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,9 @@ public function countBitstreams($communityDao, $userDao = null)
374374
* which should be one of MIDAS_COMMUNITY_PUBLIC, MIDAS_COMMUNITY_PRIVATE.
375375
*
376376
* @param CommunityDao $communityDao
377-
* @param type $privacyCode
378-
* @param type $userDao
377+
* @param int $privacyCode
378+
* @param UserDao $userDao
379+
* @throws Zend_Exception
379380
*/
380381
public function setPrivacy($communityDao, $privacyCode, $userDao)
381382
{
@@ -384,7 +385,7 @@ public function setPrivacy($communityDao, $privacyCode, $userDao)
384385
}
385386
if ($privacyCode === false || ($privacyCode != MIDAS_COMMUNITY_PUBLIC && $privacyCode != MIDAS_COMMUNITY_PRIVATE)
386387
) {
387-
throw new Exception('invalid value for privacyCode: '.$privacyCode);
388+
throw new Zend_Exception('invalid value for privacyCode: '.$privacyCode);
388389
}
389390

390391
$feedModel = MidasLoader::loadModel('Feed');

core/models/base/ItemModelBase.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,10 @@ public function addReadonlyPolicy($itemdao, $folderdao)
280280
* input userDao parameter (who run this operation) and access policy is based on
281281
* the input folderDao parameter (destination folder)
282282
*
283-
* @param ItemDao $itemDao the item to be duplicated
284-
* @param UserDao $userDao the user who run this operation
285-
* @param FolderDao $folderDao destination folder
283+
* @param ItemDao $itemDao the item to be duplicated
284+
* @param UserDao $userDao the user who run this operation
285+
* @param FolderDao $folderDao destination folder
286+
* @return ItemDao
286287
* @throws Zend_Exception on invalid input parameters (itemDao, userDao and folderDao)
287288
*/
288289
public function duplicateItem($itemDao, $userDao, $folderDao)
@@ -403,9 +404,12 @@ public function incrementDownloadCount($itemdao)
403404
Zend_Registry::get('notifier')->callback("CALLBACK_CORE_PLUS_ONE_DOWNLOAD", array('item' => $itemdao));
404405
}
405406

406-
/** Add a revision to an item
407+
/**
408+
* Add a revision to an item.
407409
*
408-
* @return void
410+
* @param ItemDao $itemdao
411+
* @param ItemRevisionDao $revisiondao
412+
* @throws Zend_Exception
409413
*/
410414
public function addRevision($itemdao, $revisiondao)
411415
{
@@ -435,7 +439,9 @@ public function addRevision($itemdao, $revisiondao)
435439
* Delete an itemrevision from an item, will reduce all other
436440
* itemrevision revision numbers appropriately.
437441
*
438-
* @return void
442+
* @param ItemDao $itemdao
443+
* @param ItemRevisionDao $revisiondao
444+
* @throws Zend_Exception
439445
*/
440446
public function removeRevision($itemdao, $revisiondao)
441447
{

0 commit comments

Comments
 (0)