Skip to content

Commit 7d51716

Browse files
committed
Handle Backward Compatibility
1 parent 4f681dc commit 7d51716

2 files changed

Lines changed: 23 additions & 22 deletions

File tree

lib/net/authorize/api/contract/v1/Mapper.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,9 @@ function __construct() {
4444

4545
public function getClass(string $class, string $property){
4646

47-
echo "getClass calling : class - " . $class . " property - " . $property . "\n";
47+
//echo "getClass calling : class - " . $class . " property - " . $property . "\n";
4848
$obj = new MapperObj;
4949

50-
5150
if(isset($this->classes[$class]['properties'][$property]['type'])){
5251
$className = $this->classes[$class]['properties'][$property]['type'];
5352
if(substr( $className, 0, 5 ) === "array"){
@@ -69,7 +68,7 @@ public function getClass(string $class, string $property){
6968
return $obj;
7069
}
7170
else if(get_parent_class($class)){
72-
echo "Checking parent class in YAML - ".get_parent_class($class)." -".$class." - ".$property."\n";
71+
//echo "Checking parent class in YAML - ".get_parent_class($class)." -".$class." - ".$property."\n";
7372
return (new Mapper)->getClass(get_parent_class($class), $property);
7473
}
7574
// else if ($property == "refId" || $property == "sessionToken" ){
@@ -85,7 +84,7 @@ public function getClass(string $class, string $property){
8584
// }
8685
else{
8786
echo "Error finding in YAML - ".$classname." - ".$property."\n";
88-
$obj->className = 'string';
87+
$obj = NULL;
8988
return $obj;
9089
}
9190
// return $this->classes[$classname]['properties'][$property]['type'];

scripts/appendSetCode.txt

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,30 @@
1010
// $classname = rtrim($classname, '>');
1111
// $isarray = true;
1212
//}
13-
if ($classDetails->isArray) {
14-
if ($classDetails->isCustomDefined) {
15-
foreach($value AS $keyChild => $valueChild) {
16-
$type = new $classDetails->className;
17-
$type->set($valueChild);
18-
$this->{'addTo' . $key}($type);
13+
if($classDetails !== NULL ) {
14+
if ($classDetails->isArray) {
15+
if ($classDetails->isCustomDefined) {
16+
foreach($value AS $keyChild => $valueChild) {
17+
$type = new $classDetails->className;
18+
$type->set($valueChild);
19+
$this->{'addTo' . $key}($type);
20+
}
1921
}
20-
}
21-
else {
22-
foreach($value AS $keyChild => $valueChild) {
23-
$this->{'addTo' . $key}($valueChild);
22+
else {
23+
foreach($value AS $keyChild => $valueChild) {
24+
$this->{'addTo' . $key}($valueChild);
25+
}
2426
}
2527
}
26-
}
27-
else {
28-
if ($classDetails->isCustomDefined){
29-
$type = new $classDetails->className;
30-
$type->set($value);
31-
$this->{'set' . $key}($type);
32-
}
3328
else {
34-
$this->{'set' . $key}($value);
29+
if ($classDetails->isCustomDefined){
30+
$type = new $classDetails->className;
31+
$type->set($value);
32+
$this->{'set' . $key}($type);
33+
}
34+
else {
35+
$this->{'set' . $key}($value);
36+
}
3537
}
3638
}
3739
}

0 commit comments

Comments
 (0)