Permalink
Browse files

Add/improve inline code documentation

  • Loading branch information...
1 parent e6232c2 commit c55ccb8a58d5e3f2a703d5c56aa069656752a393 @Krinkle Krinkle committed Apr 11, 2012
View
2 inc/BrowserInfo.php
@@ -47,7 +47,7 @@ public static function getSwarmUAIndex() {
foreach ( $rawIndex as $uaID => $uaItem ) {
if ( is_array( $uaItem ) ) {
$uaItem2 = $uaItem;
- foreach( $uaItem2 as $uaDataKey => $uaDataVal ) {
+ foreach ( $uaItem2 as $uaDataKey => $uaDataVal ) {
if ( $uaDataKey !== "displaytitle" && $uaDataKey !== "displayicon" ) {
$uaItem[$uaDataKey] = (bool)trim( $uaDataVal );
} else {
View
2 inc/WebRequest.php
@@ -142,7 +142,7 @@ private function checkMagicQuotes() {
*/
private function &fix_magic_quotes( &$arr, $topLevel = true ) {
$clean = array();
- foreach( $arr as $key => $val ) {
+ foreach ( $arr as $key => $val ) {
if ( is_array( $val ) ) {
$cleanKey = $topLevel ? stripslashes( $key ) : $key;
$clean[$cleanKey] = $this->fix_magic_quotes( $arr[$key], false );
View
14 inc/actions/AddjobAction.php
@@ -1,6 +1,9 @@
<?php
/**
* "Addjob" action.
+ * Addjob ignores the current session. Instead it uses tokens, which (although
+ * all registered users have an auth token in the database), only trusted
+ * users know their own token.
*
* @author John Resig, 2008-2011
* @author Timo Tijhof, 2012
@@ -11,9 +14,14 @@
class AddjobAction extends Action {
/**
- * Addjob ignores the current session.
- * Instead it uses tokens, which (although all registered users have an auth token
- * in the database), only trusted users know their own token.
+ * @actionMethod POST: Required.
+ * @actionParam authUsername string
+ * @actionParam authToken string
+ * @actionParam jobName string: May contain HTML.
+ * @actionParam runMax int
+ * @actionParam runNames array
+ * @actionParam runUrls array
+ * @actionParam browserSets array
*/
public function doAction() {
$db = $this->getContext()->getDB();
View
5 inc/actions/CleanupAction.php
@@ -1,6 +1,6 @@
<?php
/**
- * "Cleanup" action (previously action=wipe)
+ * "Cleanup" action (previously WipeAction)
*
* @author John Resig, 2008-2011
* @since 0.1.0
@@ -9,6 +9,9 @@
class CleanupAction extends Action {
+ /**
+ * @actionNote This action takes no parameters.
+ */
public function doAction() {
$browserInfo = $this->getContext()->getBrowserInfo();
$db = $this->getContext()->getDB();
View
4 inc/actions/GetrunAction.php
@@ -9,6 +9,10 @@
class GetrunAction extends Action {
+ /**
+ * @actionMethod POST: Required.
+ * @actionParam client_id int
+ */
public function doAction() {
$browserInfo = $this->getContext()->getBrowserInfo();
$db = $this->getContext()->getDB();
View
3 inc/actions/InfoAction.php
@@ -9,6 +9,9 @@
class InfoAction extends Action {
+ /**
+ * @actionNote This action takes no parameters.
+ */
public function doAction() {
$conf = $this->getContext()->getConf();
View
5 inc/actions/JobAction.php
@@ -9,6 +9,9 @@
class JobAction extends Action {
+ /**
+ * @actionParam item int: Job ID.
+ */
public function doAction() {
$db = $this->getContext()->getDB();
$request = $this->getContext()->getRequest();
@@ -73,7 +76,7 @@ public function doAction() {
$userAgentIDs = array();
- foreach( $runRows as $runRow ) {
+ foreach ( $runRows as $runRow ) {
$runInfo = array(
"id" => $runRow->run_id,
"name" => $runRow->run_name,
View
5 inc/actions/LoginAction.php
@@ -9,6 +9,11 @@
class LoginAction extends Action {
+ /**
+ * @actionMethod POST: Required.
+ * @actionParam username string
+ * @actionParam password string
+ */
public function doAction() {
$db = $this->getContext()->getDB();
$request = $this->getContext()->getRequest();
View
3 inc/actions/LogoutAction.php
@@ -8,6 +8,9 @@
*/
class LogoutAction extends Action {
+ /**
+ * @actionNote This action takes no parameters.
+ */
public function doAction() {
$request = $this->getContext()->getRequest();
$request->setSessionData( "username", null );
View
5 inc/actions/ProjectsAction.php
@@ -9,7 +9,10 @@
class ProjectsAction extends Action {
/**
- * @requestParam "sort" string: [optional] Defaults to "name".
+ * @requestParam sort string: [optional] What to sort the results by.
+ * Must be one of "name", "id", "creation" or "jobcount". Defaults to "name".
+ * @requestParam sort_order string: [optional]
+ * Must be one of "asc" (ascending" or "desc" (decending). Defaults to "asc".
*/
public function doAction() {
$db = $this->getContext()->getDB();
View
9 inc/actions/SaverunAction.php
@@ -10,6 +10,15 @@
class SaverunAction extends Action {
+ /**
+ * @actionMethod POST: Required.
+ * @actionParam client_id int
+ * @actionParam run_id int
+ * @actionParam fail int
+ * @actionParam error int
+ * @actionParam total int
+ * @actionParam results string: HTML snapshot of the test results page.
+ */
public function doAction() {
$browserInfo = $this->getContext()->getBrowserInfo();
$db = $this->getContext()->getDB();
View
3 inc/actions/ScoresAction.php
@@ -10,6 +10,9 @@
class ScoresAction extends Action {
+ /**
+ * @actionNote This action takes no parameters.
+ */
public function doAction() {
$db = $this->getContext()->getDB();
View
5 inc/actions/SignupAction.php
@@ -10,6 +10,11 @@
class SignupAction extends Action {
+ /**
+ * @actionMethod POST: Required.
+ * @actionParam username string
+ * @actionParam password string
+ */
public function doAction() {
$db = $this->getContext()->getDB();
View
5 inc/actions/SwarmstateAction.php
@@ -11,7 +11,8 @@
class SwarmstateAction extends Action {
/**
- * @requestParam "onlyactive" Only include user agents that online clients and/or pending runs.
+ * @requestParam onlyactive bool: If true, only user agents that
+ * have online clients and/or pending runs are included.
*/
public function doAction() {
$db = $this->getContext()->getDB();
@@ -25,7 +26,7 @@ public function doAction() {
$uaIndex = BrowserInfo::getSwarmUAIndex();
- foreach( $uaIndex as $uaID => $uaData ) {
+ foreach ( $uaIndex as $uaID => $uaData ) {
if ( $uaData->active !== true ) {
continue;
}
View
9 js/run.js
@@ -16,7 +16,9 @@
function log( htmlMsg ) {
$( "#history" ).prepend( "<li><strong>" +
new Date().toString().replace( /^\w+ /, "" ).replace( /:[^:]+$/, "" ) +
- ":</strong> " + htmlMsg + "</li>" );
+ ":</strong> " + htmlMsg + "</li>"
+ );
+
msg( htmlMsg );
}
@@ -37,6 +39,11 @@
}
};
+ /**
+ * @param query String|Object: $.ajax "data" option, converted with $.param.
+ * @param retry Function
+ * @param ok Function
+ */
function retrySend( query, retry, ok ) {
$.ajax({
type: "POST",

0 comments on commit c55ccb8

Please sign in to comment.