summaryrefslogtreecommitdiff
path: root/vendor/aws/aws-sdk-php/src/Result.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2022-11-23 21:14:33 +0300
committerAndrew Dolgov <[email protected]>2022-11-23 21:14:33 +0300
commit0c8af4992cb0f7589dcafaad65ada12753c64594 (patch)
tree18e83d068c3e7dd2499331de977782b382279396 /vendor/aws/aws-sdk-php/src/Result.php
initial
Diffstat (limited to 'vendor/aws/aws-sdk-php/src/Result.php')
-rw-r--r--vendor/aws/aws-sdk-php/src/Result.php57
1 files changed, 57 insertions, 0 deletions
diff --git a/vendor/aws/aws-sdk-php/src/Result.php b/vendor/aws/aws-sdk-php/src/Result.php
new file mode 100644
index 0000000..0e3b373
--- /dev/null
+++ b/vendor/aws/aws-sdk-php/src/Result.php
@@ -0,0 +1,57 @@
+<?php
+namespace Aws;
+
+use JmesPath\Env as JmesPath;
+
+/**
+ * AWS result.
+ */
+class Result implements ResultInterface, MonitoringEventsInterface
+{
+ use HasDataTrait;
+ use HasMonitoringEventsTrait;
+
+ public function __construct(array $data = [])
+ {
+ $this->data = $data;
+ }
+
+ public function hasKey($name)
+ {
+ return isset($this->data[$name]);
+ }
+
+ public function get($key)
+ {
+ return $this[$key];
+ }
+
+ public function search($expression)
+ {
+ return JmesPath::search($expression, $this->toArray());
+ }
+
+ public function __toString()
+ {
+ $jsonData = json_encode($this->toArray(), JSON_PRETTY_PRINT);
+ return <<<EOT
+Model Data
+----------
+Data can be retrieved from the model object using the get() method of the
+model (e.g., `\$result->get(\$key)`) or "accessing the result like an
+associative array (e.g. `\$result['key']`). You can also execute JMESPath
+expressions on the result data using the search() method.
+
+{$jsonData}
+
+EOT;
+ }
+
+ /**
+ * @deprecated
+ */
+ public function getPath($path)
+ {
+ return $this->search(str_replace('/', '.', $path));
+ }
+}