Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
}
],
"require": {
"php": ">=5.3.3",
"php": ">=5.4.0",
"ext-curl": "*",
"ext-json": "*",
"ext-mbstring": "*"
Expand Down
12 changes: 8 additions & 4 deletions lib/ApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

namespace DwollaSwagger;

use DwollaSwagger\interfaces\ModelInterface;

class ApiClient {

public static $PATCH = "PATCH";
Expand Down Expand Up @@ -334,9 +336,10 @@ protected function sanitizeForSerialization($data)
$sanitized = $data;
} else if (is_object($data)) {
$values = array();
foreach (array_keys($data::$swaggerTypes) as $property) {
/** @var ModelInterface $data */
foreach (array_keys($data::getSwaggerTypes()) as $property) {
if ($data->$property !== null) {
$values[$data::$attributeMap[$property]] = $this->sanitizeForSerialization($data->$property);
$values[$data::getAttributeMap()[$property]] = $this->sanitizeForSerialization($data->$property);
}
}
$sanitized = $values;
Expand Down Expand Up @@ -445,10 +448,11 @@ public static function deserialize($data, $class)
settype($data, $class);
$deserialized = $data;
} else {
/** @var ModelInterface $instance */
$class = "DwollaSwagger\\models\\".$class;
$instance = new $class();
foreach ($instance::$swaggerTypes as $property => $type) {
$original_property_name = $instance::$attributeMap[$property];
foreach ($instance::getSwaggerTypes() as $property => $type) {
$original_property_name = $instance::getAttributeMap()[$property];
if (isset($original_property_name) && isset($data->$original_property_name)) {
$instance->$property = self::deserialize($data->$original_property_name, $type);
}
Expand Down
28 changes: 28 additions & 0 deletions lib/interfaces/ModelInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
/**
* Created by Chris Piggott.
* User: cpiggott
* Date: 2019-02-27
* Time: 15:30
*/

namespace DwollaSwagger\interfaces;


interface ModelInterface
{
/**
* @return array Get Swagger Types
*/
static function getSwaggerTypes();

/**
* @return array Get array of attributes
*/
static function getAttributeMap();

public function offsetExists($offset);
public function offsetGet($offset);
public function offsetSet($offset, $value);
public function offsetUnset($offset);
}
21 changes: 19 additions & 2 deletions lib/models/AccountInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
namespace DwollaSwagger\models;

use \ArrayAccess;
use DwollaSwagger\interfaces\ModelInterface;

class AccountInfo implements ArrayAccess {
class AccountInfo implements ArrayAccess, ModelInterface {
static $swaggerTypes = array(
'_links' => 'map[string,HalLink]',
'id' => 'string',
Expand All @@ -41,7 +42,7 @@ class AccountInfo implements ArrayAccess {
'_embedded' => '_embedded'
);


public $_links; /* map[string,HalLink] */
public $id; /* string */
public $name; /* string */
Expand All @@ -54,6 +55,22 @@ public function __construct(array $data = null) {
$this->_embedded = $data["_embedded"];
}

/**
* @return array static $swaggerTypes swagger types
*/
public static function getSwaggerTypes()
{
return self::$swaggerTypes;
}

/**
* @return array static $attributeMap attribute map
*/
public static function getAttributeMap()
{
return self::$attributeMap;
}

public function offsetExists($offset) {
return isset($this->$offset);
}
Expand Down
19 changes: 18 additions & 1 deletion lib/models/AccountOAuthToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
namespace DwollaSwagger\models;

use \ArrayAccess;
use DwollaSwagger\interfaces\ModelInterface;

class AccountOAuthToken implements ArrayAccess {
class AccountOAuthToken implements ArrayAccess, ModelInterface {
static $swaggerTypes = array(
'_links' => 'map[string,HalLink]',
'_embedded' => 'object',
Expand All @@ -50,6 +51,22 @@ public function __construct(array $data = null) {
$this->token = $data["token"];
}

/**
* @return array static $swaggerTypes swagger types
*/
public static function getSwaggerTypes()
{
return self::$swaggerTypes;
}

/**
* @return array static $attributeMap attribute map
*/
public static function getAttributeMap()
{
return self::$attributeMap;
}

public function offsetExists($offset) {
return isset($this->$offset);
}
Expand Down
19 changes: 18 additions & 1 deletion lib/models/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
namespace DwollaSwagger\models;

use \ArrayAccess;
use DwollaSwagger\interfaces\ModelInterface;

class Address implements ArrayAccess {
class Address implements ArrayAccess, ModelInterface {
static $swaggerTypes = array(
'address1' => 'string',
'address2' => 'string',
Expand Down Expand Up @@ -66,6 +67,22 @@ public function __construct(array $data = null) {
$this->postal_code = $data["postal_code"];
}

/**
* @return array static $swaggerTypes swagger types
*/
public static function getSwaggerTypes()
{
return self::$swaggerTypes;
}

/**
* @return array static $attributeMap attribute map
*/
public static function getAttributeMap()
{
return self::$attributeMap;
}

public function offsetExists($offset) {
return isset($this->$offset);
}
Expand Down
19 changes: 18 additions & 1 deletion lib/models/Amount.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
namespace DwollaSwagger\models;

use \ArrayAccess;
use DwollaSwagger\interfaces\ModelInterface;

class Amount implements ArrayAccess {
class Amount implements ArrayAccess, ModelInterface {
static $swaggerTypes = array(
'value' => 'string',
'currency' => 'string'
Expand All @@ -46,6 +47,22 @@ public function __construct(array $data = null) {
$this->currency = $data["currency"];
}

/**
* @return array static $swaggerTypes swagger types
*/
public static function getSwaggerTypes()
{
return self::$swaggerTypes;
}

/**
* @return array static $attributeMap attribute map
*/
public static function getAttributeMap()
{
return self::$attributeMap;
}

public function offsetExists($offset) {
return isset($this->$offset);
}
Expand Down
19 changes: 18 additions & 1 deletion lib/models/ApplicationEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
namespace DwollaSwagger\models;

use \ArrayAccess;
use DwollaSwagger\interfaces\ModelInterface;

class ApplicationEvent implements ArrayAccess {
class ApplicationEvent implements ArrayAccess, ModelInterface {
static $swaggerTypes = array(
'_links' => 'map[string,HalLink]',
'_embedded' => 'object',
Expand Down Expand Up @@ -62,6 +63,22 @@ public function __construct(array $data = null) {
$this->resource_id = $data["resource_id"];
}

/**
* @return array static $swaggerTypes swagger types
*/
public static function getSwaggerTypes()
{
return self::$swaggerTypes;
}

/**
* @return array static $attributeMap attribute map
*/
public static function getAttributeMap()
{
return self::$attributeMap;
}

public function offsetExists($offset) {
return isset($this->$offset);
}
Expand Down
20 changes: 18 additions & 2 deletions lib/models/Authorization.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
namespace DwollaSwagger\models;

use \ArrayAccess;
use DwollaSwagger\interfaces\ModelInterface;

class Authorization implements ArrayAccess {
class Authorization implements ArrayAccess, ModelInterface {
static $swaggerTypes = array(

);
Expand All @@ -35,12 +36,27 @@ class Authorization implements ArrayAccess {

);



public function __construct(array $data = null) {

}

/**
* @return array static $swaggerTypes swagger types
*/
public static function getSwaggerTypes()
{
return self::$swaggerTypes;
}

/**
* @return array static $attributeMap attribute map
*/
public static function getAttributeMap()
{
return self::$attributeMap;
}

public function offsetExists($offset) {
return isset($this->$offset);
}
Expand Down
19 changes: 18 additions & 1 deletion lib/models/BeneficialOwnerListResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
namespace DwollaSwagger\models;

use \ArrayAccess;
use DwollaSwagger\interfaces\ModelInterface;

class BeneficialOwnerListResponse implements ArrayAccess {
class BeneficialOwnerListResponse implements ArrayAccess, ModelInterface {
static $swaggerTypes = array(
'_links' => 'map[string,HalLink]',
'_embedded' => 'object',
Expand All @@ -50,6 +51,22 @@ public function __construct(array $data = null) {
$this->total = $data["total"];
}

/**
* @return array static $swaggerTypes swagger types
*/
public static function getSwaggerTypes()
{
return self::$swaggerTypes;
}

/**
* @return array static $attributeMap attribute map
*/
public static function getAttributeMap()
{
return self::$attributeMap;
}

public function offsetExists($offset) {
return isset($this->$offset);
}
Expand Down
19 changes: 18 additions & 1 deletion lib/models/BusinessClassification.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
namespace DwollaSwagger\models;

use \ArrayAccess;
use DwollaSwagger\interfaces\ModelInterface;

class BusinessClassification implements ArrayAccess {
class BusinessClassification implements ArrayAccess, ModelInterface {
static $swaggerTypes = array(
'_links' => 'map[string,HalLink]',
'_embedded' => 'object',
Expand Down Expand Up @@ -54,6 +55,22 @@ public function __construct(array $data = null) {
$this->name = $data["name"];
}

/**
* @return array static $swaggerTypes swagger types
*/
public static function getSwaggerTypes()
{
return self::$swaggerTypes;
}

/**
* @return array static $attributeMap attribute map
*/
public static function getAttributeMap()
{
return self::$attributeMap;
}

public function offsetExists($offset) {
return isset($this->$offset);
}
Expand Down
20 changes: 19 additions & 1 deletion lib/models/BusinessClassificationListResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
namespace DwollaSwagger\models;

use \ArrayAccess;
use DwollaSwagger\interfaces\ModelInterface;

class BusinessClassificationListResponse implements ArrayAccess {
class BusinessClassificationListResponse implements ArrayAccess, ModelInterface {
static $swaggerTypes = array(
'_links' => 'map[string,HalLink]',
'_embedded' => 'object',
Expand All @@ -50,6 +51,23 @@ public function __construct(array $data = null) {
$this->total = $data["total"];
}


/**
* @return array static $swaggerTypes swagger types
*/
public static function getSwaggerTypes()
{
return self::$swaggerTypes;
}

/**
* @return array static $attributeMap attribute map
*/
public static function getAttributeMap()
{
return self::$attributeMap;
}

public function offsetExists($offset) {
return isset($this->$offset);
}
Expand Down
Loading