@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * This class allows you to call the two S3 scripts |
4 | 4 | * to download and upload files. |
5 | 5 | * The scripts are executed using the CommandExecuter |
6 | - */ |
|
6 | + */ |
|
7 | 7 | |
8 | 8 | require_once __DIR__ . '/CommandExecuter.php'; |
9 | 9 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $cmd, |
90 | 90 | 1, |
91 | 91 | array(1 => array("pipe", "w"), |
92 | - 2 => array("pipe", "w")), |
|
92 | + 2 => array("pipe", "w")), |
|
93 | 93 | $callback, |
94 | 94 | $callbackParams, |
95 | 95 | true, |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * The scripts are executed using the CommandExecuter |
6 | 6 | */ |
7 | 7 | |
8 | -require_once __DIR__ . '/CommandExecuter.php'; |
|
8 | +require_once __DIR__.'/CommandExecuter.php'; |
|
9 | 9 | |
10 | 10 | use SA\CpeSdk; |
11 | 11 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $callbackParams = null, |
37 | 37 | $logKey = null) |
38 | 38 | { |
39 | - $cmd = "php " . __DIR__ . self::GET_FROM_S3; |
|
39 | + $cmd = "php ".__DIR__.self::GET_FROM_S3; |
|
40 | 40 | $cmd .= " --bucket $bucket"; |
41 | 41 | $cmd .= " --file $filename"; |
42 | 42 | $cmd .= " --to $saveFileTo"; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $callbackParams = null, |
61 | 61 | $logKey = null) |
62 | 62 | { |
63 | - $cmd = "php " . __DIR__ . self::PUT_IN_S3; |
|
63 | + $cmd = "php ".__DIR__.self::PUT_IN_S3; |
|
64 | 64 | $cmd .= " --bucket $bucket"; |
65 | 65 | $cmd .= " --file $filename"; |
66 | 66 | $cmd .= " --from $pathToFileToSend"; |
@@ -22,8 +22,9 @@ discard block |
||
22 | 22 | |
23 | 23 | public function __construct($cpeLogger = null) |
24 | 24 | { |
25 | - if (!$cpeLogger) |
|
26 | - $this->cpeLogger = new CpeSdk\CpeLogger(null, 'S3Utils'); |
|
25 | + if (!$cpeLogger) { |
|
26 | + $this->cpeLogger = new CpeSdk\CpeLogger(null, 'S3Utils'); |
|
27 | + } |
|
27 | 28 | $this->cpeLogger = $cpeLogger; |
28 | 29 | } |
29 | 30 | |
@@ -64,10 +65,12 @@ discard block |
||
64 | 65 | $cmd .= " --bucket $bucket"; |
65 | 66 | $cmd .= " --file $filename"; |
66 | 67 | $cmd .= " --from $pathToFileToSend"; |
67 | - if ($options['rrs']) |
|
68 | - $cmd .= " --rrs"; |
|
69 | - if ($options['encrypt']) |
|
70 | - $cmd .= " --encrypt"; |
|
68 | + if ($options['rrs']) { |
|
69 | + $cmd .= " --rrs"; |
|
70 | + } |
|
71 | + if ($options['encrypt']) { |
|
72 | + $cmd .= " --encrypt"; |
|
73 | + } |
|
71 | 74 | |
72 | 75 | // HAndle execution |
73 | 76 | return ($this->handle_s3_ops( |
@@ -96,21 +99,25 @@ discard block |
||
96 | 99 | 2 |
97 | 100 | ); |
98 | 101 | |
99 | - if ($out['outErr']) |
|
100 | - throw new CpeSdk\CpeException($out['outErr'], |
|
102 | + if ($out['outErr']) { |
|
103 | + throw new CpeSdk\CpeException($out['outErr'], |
|
101 | 104 | self::S3_OPS_FAILED); |
105 | + } |
|
102 | 106 | |
103 | - if (!$out['out']) |
|
104 | - throw new CpeSdk\CpeException("Script '$caller' didn't return any data !", |
|
107 | + if (!$out['out']) { |
|
108 | + throw new CpeSdk\CpeException("Script '$caller' didn't return any data !", |
|
105 | 109 | self::NO_OUTPUT_DATA); |
110 | + } |
|
106 | 111 | |
107 | - if (!($decoded = json_decode($out['out'], true))) |
|
108 | - throw new CpeSdk\CpeException($out['out'], |
|
112 | + if (!($decoded = json_decode($out['out'], true))) { |
|
113 | + throw new CpeSdk\CpeException($out['out'], |
|
109 | 114 | self::S3_OPS_FAILED); |
115 | + } |
|
110 | 116 | |
111 | - if ($decoded["status"] == "ERROR") |
|
112 | - throw new CpeSdk\CpeException($decoded["msg"], |
|
117 | + if ($decoded["status"] == "ERROR") { |
|
118 | + throw new CpeSdk\CpeException($decoded["msg"], |
|
113 | 119 | self::S3_OPS_FAILED); |
120 | + } |
|
114 | 121 | |
115 | 122 | return ($decoded); |
116 | 123 | } |