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

Commit

Permalink
Applied fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie Snape authored and StyleCIBot committed Aug 4, 2015
1 parent d32faa6 commit 067197d
Show file tree
Hide file tree
Showing 43 changed files with 90 additions and 92 deletions.
3 changes: 1 addition & 2 deletions core/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ protected function _exceptionHandler(Exception $exception)
* @param null|string $moduleName module from which to get the ApiComponent
* @param bool $rpcStyle wrap data in RPC-style "data" and "msg" fields
*
* {@example
* _genericAction(array('id' => 2), 'get', $apiFunctionArray) is called and
* {@example * _genericAction(array('id' => 2), 'get', $apiFunctionArray) is called and
* $apiFunctionArray is $apiFunctions = array('default' => 'itemMove',
* 'move' => 'itemMove',
* 'duplicate' => 'itemDuplicate');
Expand Down
6 changes: 3 additions & 3 deletions core/controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,9 @@ public function indexAction()
}
$modulesList[$category][$k] = $module;
if ($module->dbOk && $module->dependenciesExist) {
$countModules[$category]['visible']++;
++$countModules[$category]['visible'];
} else {
$countModules[$category]['hidden']++;
++$countModules[$category]['hidden'];
}
}

Expand Down Expand Up @@ -396,7 +396,7 @@ public function serversidefilechooserAction()
$files = array();
if (strpos(strtolower(PHP_OS), 'win') === 0) {
$files = array();
for ($c = 'A'; $c <= 'Z'; $c++) {
for ($c = 'A'; $c <= 'Z'; ++$c) {
if (is_dir($c.':')) {
$files[] = $c.':';
}
Expand Down
2 changes: 1 addition & 1 deletion core/controllers/BrowseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ public function getfolderscontentAction()
$itemCount = count($items);
if ($limit > 0 && $itemCount > $itemLimit) {
array_pop($items);
$itemCount--;
--$itemCount;
$showMoreLink = true;
}
$itemOffset += min($limit, $itemCount);
Expand Down
4 changes: 2 additions & 2 deletions core/controllers/ImportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private function _recursiveCountFiles($path)
if ($fileInfo->isDir()) {
$initialcount += $this->_recursiveCountFiles($fileInfo->getPathName());
} else {
$initialcount++;
++$initialcount;
}
}

Expand All @@ -114,7 +114,7 @@ private function _checkStopImport()
/** Increment the number of files processed and write the progress if needed */
private function _incrementFileProcessed()
{
$this->nfilesprocessed++;
++$this->nfilesprocessed;
$percent = ($this->nfilesprocessed / $this->ntotalfiles) * 100;
$count = 2; // every 2%
if ($percent % $count == 0) {
Expand Down
2 changes: 1 addition & 1 deletion core/controllers/ItemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public function viewAction()
unset($tmp[$key]);
continue;
}
$i++;
++$i;
if ($i > 4) {
unset($tmp[$key]);
}
Expand Down
20 changes: 10 additions & 10 deletions core/controllers/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ public function liveAction()
if (!isset($folderDao->count) || $folderDao->count == 1) {
$result['folderid'] = $folderDao->getFolderId();
}
$id++;
$n++;
++$id;
++$n;
$results[] = $result;
}

Expand All @@ -224,8 +224,8 @@ public function liveAction()
if (!isset($itemDao->count) || $itemDao->count == 1) {
$result['itemid'] = $itemDao->getItemId();
}
$id++;
$n++;
++$id;
++$n;
$results[] = $result;
}
// Groups
Expand All @@ -242,8 +242,8 @@ public function liveAction()
'groupid' => $groupDao->getKey(),
'category' => $this->t('Groups'),
);
$id++;
$n++;
++$id;
++$n;
}

// Community
Expand All @@ -266,8 +266,8 @@ public function liveAction()
if (!isset($communityDao->count) || $communityDao->count == 1) {
$result['communityid'] = $communityDao->getKey();
}
$id++;
$n++;
++$id;
++$n;
$results[] = $result;
}

Expand All @@ -287,8 +287,8 @@ public function liveAction()
if (!isset($userDao->count) || $userDao->count == 1) {
$result['userid'] = $userDao->getKey();
}
$id++;
$n++;
++$id;
++$n;
$results[] = $result;
}
// Other live search options
Expand Down
4 changes: 2 additions & 2 deletions core/controllers/components/DateComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static function ago($timestamp, $onlyTime = false)
$periods = array('second', 'minute', 'hour', 'day', 'week', 'month', 'year', 'decade');
$periodsFr = array('seconde', 'minute', 'heure', 'jour', 'semaine', 'mois', 'annee', 'decades');
$lengths = array('60', '60', '24', '7', '4.35', '12', '10');
for ($j = 0; $difference >= $lengths[$j]; $j++) {
for ($j = 0; $difference >= $lengths[$j]; ++$j) {
$difference /= $lengths[$j];
}
$difference = round($difference);
Expand Down Expand Up @@ -106,7 +106,7 @@ public static function duration($timestamp)
$periods = array('second', 'minute', 'hour', 'day', 'week', 'month', 'year', 'decade');
$periodsFr = array('seconde', 'minute', 'heure', 'jour', 'semaine', 'mois', 'annee', 'decades');
$lengths = array('60', '60', '24', '7', '4.35', '12', '10');
for ($j = 0; $difference >= $lengths[$j]; $j++) {
for ($j = 0; $difference >= $lengths[$j]; ++$j) {
$difference /= $lengths[$j];
}
$difference = round($difference);
Expand Down
2 changes: 1 addition & 1 deletion core/controllers/components/ExportComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function exportBitstreams($userDao, $targetDir, $itemIds, $shouldSymLink)
// Get items
$revisions = array();
if (!is_array($itemIds)) {
throw new Zend_Exception("Input parameter \$itemIds should be an array.");
throw new Zend_Exception('Input parameter $itemIds should be an array.');
}
if (!empty($itemIds)) {
foreach ($itemIds as $itemId) {
Expand Down
8 changes: 4 additions & 4 deletions core/controllers/components/PolicyComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function applyPoliciesRecursive(
}
if (!$this->Folder->policyCheck($subfolder, $user, MIDAS_POLICY_ADMIN)
) {
$results['failure']++;
++$results['failure'];
continue;
}
// delete all existing policies on the subfolder
Expand All @@ -84,7 +84,7 @@ public function applyPoliciesRecursive(
$folderPolicyUser->getPolicy()
);
}
$results['success']++;
++$results['success'];
$results = $this->applyPoliciesRecursive($subfolder, $user, $progress, $results);
}

Expand All @@ -95,7 +95,7 @@ public function applyPoliciesRecursive(
$this->Progress->updateProgress($progress, $current, $message);
}
if (!$this->Item->policyCheck($item, $user, MIDAS_POLICY_ADMIN)) {
$results['failure']++;
++$results['failure'];
continue;
}
// delete all existing policies on the item
Expand All @@ -121,7 +121,7 @@ public function applyPoliciesRecursive(
$folderPolicyUser->getPolicy()
);
}
$results['success']++;
++$results['success'];
}

return $results;
Expand Down
8 changes: 4 additions & 4 deletions core/controllers/components/UtilityComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,16 @@ public static function extractPathParams()
$tokens = array();
$i = 0;
if ($request->getModuleName() != 'default') {
$i++;
++$i;
}
if ($request->getControllerName() != 'index') {
$i++;
++$i;
}
if ($request->getActionName() != 'index') {
$i++;
++$i;
}
$max = count($allTokens);
for (; $i < $max; $i++) {
for (; $i < $max; ++$i) {
$tokens[] = $allTokens[$i];
}

Expand Down
2 changes: 1 addition & 1 deletion core/models/base/CommunityModelBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function incrementViewCount($communityDao)
$user->viewedCommunities[$communityDao->getKey()] = true;
}
}
$communityDao->view++;
++$communityDao->view;
$this->save($communityDao);
}

Expand Down
2 changes: 1 addition & 1 deletion core/models/base/FolderModelBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public function incrementViewCount($folder)
$user->viewedFolder[$folder->getKey()] = true;
}
}
$folder->view++;
++$folder->view;
parent::save($folder);
}

Expand Down
12 changes: 6 additions & 6 deletions core/models/base/ItemModelBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ public function incrementViewCount($itemdao)
$user->viewedItems[$itemdao->getKey()] = true;
}
}
$itemdao->view++;
++$itemdao->view;
parent::save($itemdao);
}

Expand All @@ -398,7 +398,7 @@ public function incrementDownloadCount($itemdao)
if (!$itemdao instanceof ItemDao) {
throw new Zend_Exception('Error in param itemdao when incrementing download count.');
}
$itemdao->download++;
++$itemdao->download;
parent::save($itemdao);
Zend_Registry::get('notifier')->callback('CALLBACK_CORE_PLUS_ONE_DOWNLOAD', array('item' => $itemdao));
}
Expand Down Expand Up @@ -537,7 +537,7 @@ public function countBitstreams($itemDao)
if ($rev) {
$bitstreams = $rev->getBitstreams();
foreach ($bitstreams as $bitstream) {
$totalCount++;
++$totalCount;
$totalSize += $bitstream->getSizebytes();
}
}
Expand Down Expand Up @@ -570,7 +570,7 @@ public function mergeItems($itemIds, $name, $userSessionDao, $progress = null)
).' due to insufficient '.'permissions.'
);
if ($progress) {
$current++;
++$current;
$message = 'Merging items: '.$current.' of '.$progress->getMaximum();
$progressModel->updateProgress($progress, $current, $message);
}
Expand All @@ -580,7 +580,7 @@ public function mergeItems($itemIds, $name, $userSessionDao, $progress = null)
__METHOD__.' User unable to merge item '.$item.' because it does not exist.'
);
if ($progress) {
$current++;
++$current;
$message = 'Merging items: '.$current.' of '.$progress->getMaximum();
$progressModel->updateProgress($progress, $current, $message);
}
Expand Down Expand Up @@ -610,7 +610,7 @@ public function mergeItems($itemIds, $name, $userSessionDao, $progress = null)
$this->delete($item);
}
if ($progress) {
$current++;
++$current;
$message = 'Merging items: '.$current.' of '.$progress->getMaximum();
$progressModel->updateProgress($progress, $current, $message);
}
Expand Down
2 changes: 1 addition & 1 deletion core/models/base/UserModelBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public function incrementViewCount($userDao)
$user->viewedUsers[$userDao->getKey()] = true;
}
}
$userDao->view++;
++$userDao->view;
$this->save($userDao);
}

Expand Down
2 changes: 1 addition & 1 deletion core/models/pdo/AssetstoreModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function moveBitstreams($srcAssetstore, $dstAssetstore, $progressDao = nu
foreach ($rows as $row) {
$bitstream = $this->initDao('Bitstream', $row);
if ($progressDao) {
$current++;
++$current;
$message = $current.' / '.$progressDao->getMaximum().': Moving '.$bitstream->getName(
).' ('.UtilityComponent::formatSize($bitstream->getSizebytes()).')';
$progressModel->updateProgress($progressDao, $current, $message);
Expand Down
2 changes: 1 addition & 1 deletion core/models/pdo/BitstreamModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function removeOrphans($progressDao = null)
$itr = 0;
foreach ($ids as $id) {
if ($progressDao) {
$itr++;
++$itr;
$message = 'Removing orphaned bitstreams ('.$itr.'/'.$max.')';
$this->Progress->updateProgress($progressDao, $itr, $message);
}
Expand Down
6 changes: 3 additions & 3 deletions core/models/pdo/FolderModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,7 @@ public function getFoldersFromSearch($search, $userDao, $limit = 14, $group = tr
$folder->score = $result['score'];
$results[] = $folder;
unset($folder);
$i++;
++$i;
if ($i >= $limit) {
break;
}
Expand Down Expand Up @@ -1490,7 +1490,7 @@ public function removeOrphans($progressDao = null)
$itr = 0;
foreach ($ids as $id) {
if ($progressDao) {
$itr++;
++$itr;
$message = 'Removing orphaned folders ('.$itr.'/'.$max.')';
$this->Progress->updateProgress($progressDao, $itr, $message);
}
Expand Down Expand Up @@ -1531,7 +1531,7 @@ public function removeOrphans($progressDao = null)
*/
protected function _recomputeSubtree($folder, &$count, $max, $progressDao = null)
{
$count++;
++$count;
if ($progressDao && $count % 10 == 0) { // only update progress every 10 folders
$message = 'Rebuilding entire folder tree index ('.$count.'/'.$max.')';
$this->Progress->updateProgress($progressDao, $count, $message);
Expand Down
6 changes: 3 additions & 3 deletions core/models/pdo/ItemModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function getItemsFromSearch($searchterm, $userDao, $limit = 14, $group =
$item->score = $result['score'];
$results[] = $item;
unset($item);
$i++;
++$i;
if ($i >= $limit) {
break;
}
Expand Down Expand Up @@ -761,7 +761,7 @@ public function removeOrphans($progressDao = null)
$itr = 0;
foreach ($ids as $id) {
if ($progressDao) {
$itr++;
++$itr;
$message = 'Removing orphaned items ('.$itr.'/'.$max.')';
$this->Progress->updateProgress($progressDao, $itr, $message);
}
Expand Down Expand Up @@ -823,7 +823,7 @@ public function updateItemName($name, $parent)
if ($curRow == null) {
break;
} else {
$count++;
++$count;
$curName = $name.' ('.$count.')';
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/models/pdo/ItemRevisionModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ public function removeOrphans($progressDao = null)
$itr = 0;
foreach ($ids as $id) {
if ($progressDao) {
$itr++;
++$itr;
$message = 'Removing orphaned revisions ('.$itr.'/'.$max.')';
$this->Progress->updateProgress($progressDao, $itr, $message);
}
Expand Down
4 changes: 2 additions & 2 deletions core/tests/models/base/ItemModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public function testDuplicate()
$this->assertTrue($rcount > 0);
$this->assertEquals($rcount, count($newRevs));

for ($i = 0; $i < $rcount; $i++) {
for ($i = 0; $i < $rcount; ++$i) {
$this->assertNotEquals($oldRevs[$i]->getKey(), $newRevs[$i]->getKey());
$this->assertNotEquals($oldRevs[$i]->getUuid(), $newRevs[$i]->getUuid());
$this->assertEquals($oldRevs[$i]->getDate(), $newRevs[$i]->getDate());
Expand All @@ -229,7 +229,7 @@ public function testDuplicate()
$newBitstreams = $newRevs[$i]->getBitstreams();
$bcount = count($oldBitstreams);
$this->assertEquals($bcount, count($newBitstreams));
for ($b = 0; $b < $bcount; $b++) {
for ($b = 0; $b < $bcount; ++$b) {
$this->assertNotEquals($oldBitstreams[$b]->getKey(), $newBitstreams[$b]->getKey());
$this->assertNotEquals(
$oldBitstreams[$b]->getItemrevisionId(),
Expand Down
Loading

0 comments on commit 067197d

Please sign in to comment.