Completed
Push — master ( a9ad96...04f2d0 )
by Nicolas
02:49
created
src/SA/CpeSdk/CpeActivity.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -11,20 +11,20 @@  discard block
 block discarded – undo
11 11
 
12 12
 class CpeActivity
13 13
 {
14
-    public $params;          // Activity params coming from ActivityPoller
15
-    public $debug;           // Debug flag
14
+    public $params; // Activity params coming from ActivityPoller
15
+    public $debug; // Debug flag
16 16
     
17
-    public $activityId;      // ID of the activity
18
-    public $activityType;    // Type of activity
17
+    public $activityId; // ID of the activity
18
+    public $activityType; // Type of activity
19 19
     
20
-    public $cpeLogger;       // Logger
21
-    public $cpeSqsWriter;    // Used to write messages in SQS
22
-    public $cpeSwfHandler;   // USed to control SWF
23
-    public $cpeJsonValidator;// Run JSON schemas validation
20
+    public $cpeLogger; // Logger
21
+    public $cpeSqsWriter; // Used to write messages in SQS
22
+    public $cpeSwfHandler; // USed to control SWF
23
+    public $cpeJsonValidator; // Run JSON schemas validation
24 24
     
25
-    public $input_str;       // Complete activity input string
26
-    public $input;           // Complete activity input JSON object
27
-    public $activityLogKey;  // Create a key workflowId:activityId to put in logs
25
+    public $input_str; // Complete activity input string
26
+    public $input; // Complete activity input JSON object
27
+    public $activityLogKey; // Create a key workflowId:activityId to put in logs
28 28
     
29 29
     const HEARTBEAT_FAILED     = "HEARTBEAT_FAILED";
30 30
     const NO_ACTIVITY_NAME     = "NO_ACTIVITY_NAME";
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         // For listening to the Input SQS queue 
45 45
         $this->cpeJsonValidator = new CpeSdk\CpeJsonValidator();     
46 46
         // Save activity params
47
-        $this->params        = $params;
47
+        $this->params = $params;
48 48
 
49 49
         // Check if there is an activity name
50 50
         if (!isset($params["name"]) || !$params["name"])
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
             return true;
91 91
         } catch (\Aws\Swf\Exception\UnknownResourceException $e) {
92 92
             $this->cpeLogger->log_out("ERROR", basename(__FILE__), 
93
-                "Activity '" . $this->params["name"] . "' doesn't exists. Creating it ...\n");
93
+                "Activity '".$this->params["name"]."' doesn't exists. Creating it ...\n");
94 94
         }
95 95
         
96 96
         // Register activites if doesn't exists in SWF
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
                 ));
171 171
         } catch (\Exception $e) {
172 172
             $this->cpeLogger->log_out("ERROR", basename(__FILE__), 
173
-                "Unable to send 'Task Failed' response ! " . $e->getMessage(),
173
+                "Unable to send 'Task Failed' response ! ".$e->getMessage(),
174 174
                 $this->activityLogKey);
175 175
             return false;
176 176
         }
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
                 ));
196 196
         } catch (\Exception $e) {
197 197
             $this->cpeLogger->log_out("ERROR", basename(__FILE__), 
198
-                "Unable to send 'Task Completed' response ! " . $e->getMessage(),
198
+                "Unable to send 'Task Completed' response ! ".$e->getMessage(),
199 199
                 $this->activityLogKey);
200 200
             return false;
201 201
         }
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
             if ($info->get("cancelRequested") == true)
224 224
             {
225 225
                 $this->cpeLogger->log_out("WARNING", basename(__FILE__), 
226
-                    "Cancel has been requested for this task '" . $task->get("activityId") . "' ! Killing task ...",
226
+                    "Cancel has been requested for this task '".$task->get("activityId")."' ! Killing task ...",
227 227
                     $this->activityLogKey);
228 228
                 throw new CpeSdk\CpeException("Cancel request. No heartbeat, leaving!",
229 229
                     self::HEARTBEAT_FAILED);
Please login to merge, or discard this patch.
src/SA/CpeSdk/CpeException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,6 +16,6 @@
 block discarded – undo
16 16
     
17 17
     // custom string representation of object
18 18
     public function __toString() {
19
-        return __CLASS__ . ": [{$this->ref}]: {$this->message}\n";
19
+        return __CLASS__.": [{$this->ref}]: {$this->message}\n";
20 20
     }
21 21
 }
Please login to merge, or discard this patch.
src/SA/CpeSdk/CpeJsonValidator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,10 +10,10 @@
 block discarded – undo
10 10
         $schemas_path)
11 11
     {
12 12
         $retriever    = new JsonSchema\Uri\UriRetriever;
13
-        $json_schemas = $retriever->retrieve('file://' . $schemas_path . "/$schemas_name");
13
+        $json_schemas = $retriever->retrieve('file://'.$schemas_path."/$schemas_name");
14 14
 
15 15
         $refResolver  = new JsonSchema\RefResolver($retriever);
16
-        $refResolver->resolve($json_schemas, 'file://' . $schemas_path . "/");
16
+        $refResolver->resolve($json_schemas, 'file://'.$schemas_path."/");
17 17
 
18 18
         $validator    = new JsonSchema\Validator();
19 19
         $validator->check($json, $json_schemas);
Please login to merge, or discard this patch.
src/SA/CpeSdk/CpeLogger.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
             $log["workflowId"] = $workflowId;
55 55
 
56 56
         // Open Syslog. Use programe name as key
57
-        if (!openlog (__FILE__, LOG_CONS|LOG_PID, LOG_LOCAL1))
57
+        if (!openlog(__FILE__, LOG_CONS|LOG_PID, LOG_LOCAL1))
58 58
             throw new CpeException("Unable to connect to Syslog!",
59 59
                 OPENLOG_ERROR);
60 60
         
@@ -96,11 +96,11 @@  discard block
 block discarded – undo
96 96
         if (!is_string($log['message']))
97 97
             $log['message'] = json_encode($log['message']);
98 98
         
99
-        $toPrint = $log['time'] . " [" . $log['type'] . "] [" . $log['source'] . "] ";
99
+        $toPrint = $log['time']." [".$log['type']."] [".$log['source']."] ";
100 100
         // If there is a workflow ID. We append it.
101 101
         if ($workflowId)
102 102
             $toPrint .= "[$workflowId] ";
103
-        $toPrint .= $log['message'] . "\n";
103
+        $toPrint .= $log['message']."\n";
104 104
             
105 105
         if (file_put_contents(
106 106
                 $this->logPath,
Please login to merge, or discard this patch.