-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- trait -> class
- Loading branch information
parkgun
committed
Feb 15, 2016
1 parent
274d870
commit e51560c
Showing
20 changed files
with
224 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/main/php/com/skplanet/syruppay/token/PropertyMapper.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.