Skip to content

Commit

Permalink
Property to array 처리 변경
Browse files Browse the repository at this point in the history
 - trait -> class
  • Loading branch information
parkgun committed Feb 15, 2016
1 parent 274d870 commit e51560c
Show file tree
Hide file tree
Showing 20 changed files with 224 additions and 269 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

## Getting Start
## PHP version
=> PHP 5.6
=> PHP 5.3.3

## Installation
### composer ([packagist](https://packagist.org/packages/syruppay/token))
```
"syruppay/token": "v1.0.0"`
"syruppay/token": "v1.0.1"`
```

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
}
],
"require": {
"syruppay/jose": "v1.0.1"
"syruppay/jose": "v1.0.2"
},
"require-dev": {
"phpunit/phpunit": "4.7.7"
"phpunit/phpunit": "4.8.23"
},

"autoload": {
Expand Down
94 changes: 18 additions & 76 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace com\skplanet\syruppay\token;


abstract class ClaimConfigurerAdapter implements ClaimConfigurer
abstract class ClaimConfigurerAdapter extends PropertyMapper implements ClaimConfigurer
{
private $builder;

Expand Down
21 changes: 9 additions & 12 deletions src/main/php/com/skplanet/syruppay/token/Jwt.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,18 @@
namespace com\skplanet\syruppay\token;


use com\skplanet\syruppay\token\utils\ClassPropertyUtils;
use com\skplanet\syruppay\token\utils\UUID;

class Jwt
class Jwt extends PropertyMapper
{
use ClassPropertyUtils;

private $aud = "https://pay.syrup.co.kr";
private $typ = "jose";
private $iss;
private $exp;
private $iat;
private $jti;
private $nbf;
private $sub;
protected $aud = "https://pay.syrup.co.kr";
protected $typ = "jose";
protected $iss;
protected $exp;
protected $iat;
protected $jti;
protected $nbf;
protected $sub;

function __construct()
{
Expand Down
47 changes: 47 additions & 0 deletions src/main/php/com/skplanet/syruppay/token/PropertyMapper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php
/**
* Created by IntelliJ IDEA.
* User: 1000808
* Date: 2016-02-15
* Time: 오후 1:17
*/

namespace com\skplanet\syruppay\token;


class PropertyMapper
{
public function __toArray()
{
$properties = get_object_vars($this);
$propertyMap = array();

foreach ($properties as $pKey => $pValue) {
if (isset($pValue)) {
$value = $pValue;
if (is_object($pValue)) {
if (method_exists($pValue, "__toArray")) {
$value = call_user_func(array($pValue, '__toArray'));
} else {
continue;
}
} else if (is_array($pValue)) {
$arValue = array();
foreach ($pValue as $pArKey => $pArValue) {
if (method_exists($pArValue, "__toArray")) {
$arValue[$pArKey] = call_user_func(array($pArValue, '__toArray'));
} else {
$arValue[] = $pArValue;
}
}

$value = $arValue;
}

$propertyMap[$pKey] = $value;
}
}

return $propertyMap;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,10 @@
namespace com\skplanet\syruppay\token\claims;


use com\skplanet\syruppay\token\utils\ClassPropertyUtils;

class MapToSyrupPayUserConfigurer extends AbstractTokenConfigurer
{
use ClassPropertyUtils;

private $mappingType;
private $mappingValue;
protected $mappingType;
protected $mappingValue;

public function getMappingType()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,12 @@
namespace com\skplanet\syruppay\token\claims;


use com\skplanet\syruppay\token\utils\ClassPropertyUtils;

class MerchantUserConfigurer extends AbstractTokenConfigurer
{
use ClassPropertyUtils;

private $mctUserId;
private $extraUserId;
private $SSOCredential;
private $deviceIdentifier;
protected $mctUserId;
protected $extraUserId;
protected $SSOCredential;
protected $deviceIdentifier;

public function getMctUserId()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,33 @@


use com\skplanet\syruppay\token\claims\elements\ProductDeliveryInfo;
use com\skplanet\syruppay\token\utils\ClassPropertyUtils;

class OrderConfigurer extends AbstractTokenConfigurer
{
use ClassPropertyUtils;

private $productPrice;
private $submallName;
private $privacyPolicyRequirements;
private $mainShippingAddressSettingDisabled;
protected $productPrice;
protected $submallName;
protected $privacyPolicyRequirements;
protected $mainShippingAddressSettingDisabled;
/**
* @var com\skplanet\syruppay\token\claims\elements\ProductDeliveryInfo
*/
private $productDeliveryInfo;
protected $productDeliveryInfo;
/**
* @var com\skplanet\syruppay\token\claims\elements\Offer
*/
private $offerList = array();
protected $offerList = array();
/**
* @var com\skplanet\syruppay\token\claims\elements\Loyalty
*/
private $loyaltyList = array();
protected $loyaltyList = array();
/**
* @var com\skplanet\syruppay\token\claims\ShippingAddress
*/
private $shippingAddressList = array();
protected $shippingAddressList = array();
/**
* @var com\skplanet\syruppay\token\claims\elements\MonthlyInstallment
*/
private $monthlyInstallmentList = array();
protected $monthlyInstallmentList = array();

function __construct()
{
Expand Down
Loading

0 comments on commit e51560c

Please sign in to comment.