Skip to content
This repository
Browse code

Add/improve inline code documentation

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

0 notes on commit c55ccb8

Please sign in to comment.
Something went wrong with that request. Please try again.