PluginProbe
Media Cloud Sync / 1.3.11
Media Cloud Sync v1.3.11
1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 All 34 releases
media-cloud-sync / includes / sdk / s3 / Aws / Result.php

Result.php in Media Cloud Sync 1.3.11, at includes/sdk/s3/Aws/Result.php

52 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Dudlewebs\WPMCS\s3\Aws;
4
5 use Dudlewebs\WPMCS\s3\JmesPath\Env as JmesPath;
6 /**
7 * AWS result.
8 */
9 class Result implements ResultInterface, MonitoringEventsInterface
10 {
11 use HasDataTrait;
12 use HasMonitoringEventsTrait;
13 public function __construct(array $data = [])
14 {
15 $this->data = $data;
16 }
17 public function hasKey($name)
18 {
19 return isset($this->data[$name]);
20 }
21 public function get($key)
22 {
23 return $this[$key];
24 }
25 public function search($expression)
26 {
27 return JmesPath::search($expression, $this->toArray());
28 }
29 public function __toString()
30 {
31 $jsonData = \json_encode($this->toArray(), \JSON_PRETTY_PRINT);
32 return <<<EOT
33 Model Data
34 ----------
35 Data can be retrieved from the model object using the get() method of the
36 model (e.g., `\$result->get(\$key)`) or "accessing the result like an
37 associative array (e.g. `\$result['key']`). You can also execute JMESPath
38 expressions on the result data using the search() method.
39
40 {$jsonData}
41
42 EOT;
43 }
44 /**
45 * @deprecated
46 */
47 public function getPath($path)
48 {
49 return $this->search(\str_replace('/', '.', $path));
50 }
51 }
52