@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | * Using the CpeClientSdk you can easily listen to the SQS |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -require __DIR__ . "/vendor/autoload.php"; |
|
| 12 | +require __DIR__."/vendor/autoload.php"; |
|
| 13 | 13 | |
| 14 | 14 | function poll_SQS_queues($CpeClientSdk, $decodedClient) |
| 15 | 15 | { |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | } |
| 25 | 25 | } |
| 26 | 26 | } catch (Exception $e) { |
| 27 | - print("[ERROR] " . $e->getMessage() . "\n"); |
|
| 27 | + print("[ERROR] ".$e->getMessage()."\n"); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | // Message polled. We delete it from SQS |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | function usage() |
| 55 | 55 | { |
| 56 | - echo("Usage: php " . basename(__FILE__) . " -c configFile [-h] [-k <key>] [-s <secret>] [-r <region>]\n"); |
|
| 56 | + echo("Usage: php ".basename(__FILE__)." -c configFile [-h] [-k <key>] [-s <secret>] [-r <region>]\n"); |
|
| 57 | 57 | echo("-h: Print this help\n"); |
| 58 | 58 | echo("-d: Debug mode\n"); |
| 59 | 59 | echo("-c: configFile\n"); |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * Such as: Start a new workflow |
| 12 | 12 | **/ |
| 13 | 13 | |
| 14 | -require __DIR__ . "/vendor/autoload.php"; |
|
| 14 | +require __DIR__."/vendor/autoload.php"; |
|
| 15 | 15 | |
| 16 | 16 | function start_job($args) |
| 17 | 17 | { |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | $CpeClientSdk->start_job($decodedClient, $content); |
| 43 | 43 | } |
| 44 | 44 | catch (Exception $e) { |
| 45 | - print("[ERROR] " . $e->getMessage() . "\n"); |
|
| 45 | + print("[ERROR] ".$e->getMessage()."\n"); |
|
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | { |
| 112 | 112 | global $help; |
| 113 | 113 | |
| 114 | - echo("Usage: php ". basename(__FILE__) . " -c configFile [-h] [-k <key>] [-s <secret>] [-r <region>]\n"); |
|
| 114 | + echo("Usage: php ".basename(__FILE__)." -c configFile [-h] [-k <key>] [-s <secret>] [-r <region>]\n"); |
|
| 115 | 115 | echo("-h: Print this help\n"); |
| 116 | 116 | echo("-d: Debug mode\n"); |
| 117 | 117 | echo("-c: configFile\n"); |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | check_input_parameters(); |
| 128 | 128 | } |
| 129 | 129 | catch (Exception $e) { |
| 130 | - print "[ERROR] " . $e->getMessage() . "\n"; |
|
| 130 | + print "[ERROR] ".$e->getMessage()."\n"; |
|
| 131 | 131 | exit(2); |
| 132 | 132 | } |
| 133 | 133 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * It opens the JSON input and starts a execute a callback corresponding to the command |
| 35 | 35 | */ |
| 36 | 36 | |
| 37 | -require_once __DIR__ . "/../vendor/autoload.php"; |
|
| 37 | +require_once __DIR__."/../vendor/autoload.php"; |
|
| 38 | 38 | |
| 39 | 39 | use Aws\Swf\Exception; |
| 40 | 40 | use SA\CpeSdk; |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | foreach ($this->config->{'clients'} as $client) |
| 96 | 96 | { |
| 97 | 97 | $msg = null; |
| 98 | - $this->cpeLogger->log_out("DEBUG", __DIR__, "Polling from client: " . print_r($client, true)); |
|
| 98 | + $this->cpeLogger->log_out("DEBUG", __DIR__, "Polling from client: ".print_r($client, true)); |
|
| 99 | 99 | |
| 100 | 100 | // Long Polling messages from client input queue |
| 101 | 101 | $queue = $client->{'queues'}->{'input'}; |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $this->cpeLogger->log_out( |
| 140 | 140 | "ERROR", |
| 141 | 141 | basename(__FILE__), |
| 142 | - "Command '" . $message->{"type"} . "' is unknown! Ignoring ..." |
|
| 142 | + "Command '".$message->{"type"}."' is unknown! Ignoring ..." |
|
| 143 | 143 | ); |
| 144 | 144 | return; |
| 145 | 145 | } |
@@ -147,13 +147,13 @@ discard block |
||
| 147 | 147 | $this->cpeLogger->log_out( |
| 148 | 148 | "INFO", |
| 149 | 149 | basename(__FILE__), |
| 150 | - "Received message '" . $message->{"type"} . "'" |
|
| 150 | + "Received message '".$message->{"type"}."'" |
|
| 151 | 151 | ); |
| 152 | 152 | if ($this->debug) |
| 153 | 153 | $this->cpeLogger->log_out( |
| 154 | 154 | "DEBUG", |
| 155 | 155 | basename(__FILE__), |
| 156 | - "Details:\n" . json_encode($message, JSON_PRETTY_PRINT) |
|
| 156 | + "Details:\n".json_encode($message, JSON_PRETTY_PRINT) |
|
| 157 | 157 | ); |
| 158 | 158 | |
| 159 | 159 | // We call the callback function that handles this message |
@@ -226,10 +226,10 @@ discard block |
||
| 226 | 226 | private function validate_message($message) |
| 227 | 227 | { |
| 228 | 228 | if (!isset($message) || |
| 229 | - !isset($message->{"time"}) || $message->{"time"} == "" || |
|
| 230 | - !isset($message->{"jobId"}) || $message->{"jobId"} == "" || |
|
| 231 | - !isset($message->{"type"}) || $message->{"type"} == "" || |
|
| 232 | - !isset($message->{"data"}) || $message->{"data"} == "") |
|
| 229 | + !isset($message->{"time"}) || $message->{"time"} == "" || |
|
| 230 | + !isset($message->{"jobId"}) || $message->{"jobId"} == "" || |
|
| 231 | + !isset($message->{"type"}) || $message->{"type"} == "" || |
|
| 232 | + !isset($message->{"data"}) || $message->{"data"} == "") |
|
| 233 | 233 | throw new CpeSdk\CpeException("'time', 'type', 'jobId' or 'data' fields missing in JSON message file!", |
| 234 | 234 | self::INVALID_JSON); |
| 235 | 235 | |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | function usage($defaultConfigFile) |
| 251 | 251 | { |
| 252 | 252 | echo("# Description\nThe InputPoller connects your client applications to your stack. It handles communication over the two SQS channels you created for your client application.\n\n"); |
| 253 | - echo("Usage: php ". basename(__FILE__) . " [-h] [-d] -n <client_name> [-l <log path>]\n"); |
|
| 253 | + echo("Usage: php ".basename(__FILE__)." [-h] [-d] -n <client_name> [-l <log path>]\n"); |
|
| 254 | 254 | echo("-h: Print this help\n"); |
| 255 | 255 | echo("-d: Debug mode\n"); |
| 256 | 256 | echo("-l <log_path>: Location where logs will be dumped in (folder).\n"); |
@@ -287,9 +287,9 @@ discard block |
||
| 287 | 287 | $cpeLogger = new CpeSdk\CpeLogger($logPath, $options['n'], $debug); |
| 288 | 288 | |
| 289 | 289 | $config = new \stdClass; |
| 290 | - $config->clients = [(object)[ |
|
| 290 | + $config->clients = [(object) [ |
|
| 291 | 291 | 'name' => $options['n'], |
| 292 | - 'queues' => (object)[ |
|
| 292 | + 'queues' => (object) [ |
|
| 293 | 293 | 'input' => getenv('INPUT_QUEUE'), |
| 294 | 294 | 'output' => getenv('OUTPUT_QUEUE'), |
| 295 | 295 | ], |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * It will process tasks only coming in the TaskList |
| 37 | 37 | */ |
| 38 | 38 | |
| 39 | -require_once __DIR__ . "/../vendor/autoload.php"; |
|
| 39 | +require_once __DIR__."/../vendor/autoload.php"; |
|
| 40 | 40 | |
| 41 | 41 | use Aws\Swf\Exception; |
| 42 | 42 | use SA\CpeSdk; |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | // Poll from all the taskList registered for each activities |
| 101 | 101 | if ($this->debug) |
| 102 | 102 | $this->cpeLogger->log_out("DEBUG", basename(__FILE__), |
| 103 | - "Polling activity taskList '" . $this->taskList . "' ... "); |
|
| 103 | + "Polling activity taskList '".$this->taskList."' ... "); |
|
| 104 | 104 | |
| 105 | 105 | try { |
| 106 | 106 | // Call SWF and poll for incoming tasks |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | $this->process_activity_task($activityTask); |
| 114 | 114 | } catch (CpeSdk\CpeException $e) { |
| 115 | 115 | $this->cpeLogger->log_out("ERROR", basename(__FILE__), |
| 116 | - "Unable to poll activity tasks! " . $e->getMessage()); |
|
| 116 | + "Unable to poll activity tasks! ".$e->getMessage()); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | return true; |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | $this->cpeLogger->log_out("INFO", |
| 131 | 131 | basename(__FILE__), |
| 132 | 132 | "Starting activity: name=" |
| 133 | - . $activityType['name'] . ",version=" . $activityType['version'], |
|
| 133 | + . $activityType['name'].",version=".$activityType['version'], |
|
| 134 | 134 | $workflowExecution['workflowId']); |
| 135 | 135 | |
| 136 | 136 | // Has activity handler object been instantiated ? |
@@ -154,14 +154,14 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | if ($this->debug) |
| 156 | 156 | $this->cpeLogger->log_out("DEBUG", basename(__FILE__), |
| 157 | - "Activity input:\n" . print_r($this->activityHandler->input, true)); |
|
| 157 | + "Activity input:\n".print_r($this->activityHandler->input, true)); |
|
| 158 | 158 | |
| 159 | 159 | // Run activity task |
| 160 | 160 | $result = $this->activityHandler->do_activity($activityTask); |
| 161 | 161 | |
| 162 | 162 | if ($this->debug && $result) |
| 163 | 163 | $this->cpeLogger->log_out("DEBUG", basename(__FILE__), |
| 164 | - "Activity output:\n" . print_r($result, true)); |
|
| 164 | + "Activity output:\n".print_r($result, true)); |
|
| 165 | 165 | |
| 166 | 166 | } catch (CpeSdk\CpeException $e) { |
| 167 | 167 | $reason = $e->ref; |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | { |
| 203 | 203 | $this->cpeLogger->log_out("ERROR", basename(__FILE__), |
| 204 | 204 | "The code file '".$activityToHandle->{"file"}."' for activity: name=" |
| 205 | - . $activityToHandle->{"name"} . ",version=" |
|
| 205 | + . $activityToHandle->{"name"}.",version=" |
|
| 206 | 206 | . $activityToHandle->{"version"}." doesn't exists! Check if the file is accessible and if the path is correct in your config file."); |
| 207 | 207 | return false; |
| 208 | 208 | } |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | |
| 233 | 233 | $this->cpeLogger->log_out("INFO", basename(__FILE__), |
| 234 | 234 | "Activity handler registered: name=" |
| 235 | - . $activityToHandle->{"name"} . ",version=" |
|
| 235 | + . $activityToHandle->{"name"}.",version=" |
|
| 236 | 236 | . $activityToHandle->{"version"}); |
| 237 | 237 | |
| 238 | 238 | return true; |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | |
| 242 | 242 | $this->cpeLogger->log_out("ERROR", basename(__FILE__), |
| 243 | 243 | "No Activity handler was found for: name=" |
| 244 | - . $this->activityName . ",version=" |
|
| 244 | + . $this->activityName.",version=" |
|
| 245 | 245 | . $this->activityVersion.". Check your config file and ensure your 'activity' name AND 'version' is there."); |
| 246 | 246 | return false; |
| 247 | 247 | } |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | // Usage |
| 263 | 263 | function usage($defaultConfigFile) |
| 264 | 264 | { |
| 265 | - echo("Usage: php ". basename(__FILE__) . " -D <domain> -A <activity_name> -V <activity_version> [-T <task_list>] [-h] [-d] [-c <config_file path>] [-l <log path>]\n"); |
|
| 265 | + echo("Usage: php ".basename(__FILE__)." -D <domain> -A <activity_name> -V <activity_version> [-T <task_list>] [-h] [-d] [-c <config_file path>] [-l <log path>]\n"); |
|
| 266 | 266 | echo("-h: Print this help\n"); |
| 267 | 267 | echo("-d: Debug mode\n"); |
| 268 | 268 | echo("-c <config_file path>: Optional parameter to override the default configuration file: '$defaultConfigFile'.\n"); |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | $cpeLogger->log_out( |
| 343 | 343 | "INFO", |
| 344 | 344 | basename(__FILE__), |
| 345 | - "Config file: '" . $options['c'] . "'"); |
|
| 345 | + "Config file: '".$options['c']."'"); |
|
| 346 | 346 | $defaultConfigFile = $options['c']; |
| 347 | 347 | } |
| 348 | 348 | |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | |
| 369 | 369 | // Get config file |
| 370 | 370 | $defaultConfigFile = |
| 371 | - realpath(dirname(__FILE__)) . "/../config/cpeConfig.json"; |
|
| 371 | + realpath(dirname(__FILE__))."/../config/cpeConfig.json"; |
|
| 372 | 372 | $config = check_input_parameters($defaultConfigFile); |
| 373 | 373 | |
| 374 | 374 | // Instantiate ActivityPoller |