mirror of
https://github.com/SociallyDev/Spaces-API.git
synced 2025-08-20 05:13:42 -07:00
Version 3 release. Major re-write
This commit is contained in:
parent
127ad7e14a
commit
f9b49002c7
1507 changed files with 6592 additions and 94204 deletions
37
SpacesAPI/Result.php
Normal file
37
SpacesAPI/Result.php
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace SpacesAPI;
|
||||
|
||||
use Aws\Api\DateTimeResult;
|
||||
|
||||
/**
|
||||
* AWS Results parser
|
||||
*/
|
||||
class Result
|
||||
{
|
||||
/**
|
||||
* Convert AWS result object into plain, multidimensional array
|
||||
*
|
||||
* @param $data
|
||||
*
|
||||
* @return array|mixed
|
||||
*/
|
||||
public static function parse($data) {
|
||||
if (gettype($data) == "object" && get_class($data) == \Aws\Result::class) {
|
||||
$data = $data->toArray();
|
||||
}
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
if (is_array($value)) {
|
||||
$data[$key] = self::parse($value);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (gettype($value) == "object" && get_class($value) == DateTimeResult::class) {
|
||||
$data[$key] = strtotime($value);
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue