mirror of
https://github.com/SociallyDev/Spaces-API.git
synced 2025-08-20 13:23:47 -07:00
spaces.php
This commit is contained in:
parent
7755490b81
commit
eefa32741e
845 changed files with 50409 additions and 0 deletions
56
aws/Aws/Result.php
Normal file
56
aws/Aws/Result.php
Normal file
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
namespace Aws;
|
||||
|
||||
use JmesPath\Env as JmesPath;
|
||||
|
||||
/**
|
||||
* AWS result.
|
||||
*/
|
||||
class Result implements ResultInterface
|
||||
{
|
||||
use HasDataTrait;
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue