Skip to content

Commit 3681526

Browse files
committed
Major refactoring of underlying object model for performance reasons.
1 parent 3bf3b47 commit 3681526

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

docs/KV.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ function output_tree(\DCarbone\PHPConsulAPI\KV\KVTree $tree)
114114
}
115115
else if ($item instanceof \DCarbone\PHPConsulAPI\KV\KVPair)
116116
{
117-
echo '<li>'.$item->getKey().'</li>';
117+
echo '<li>'.$item->Key.': '.$item->Value.'</li>';
118118
}
119119
}
120120
}
@@ -134,7 +134,7 @@ foreach($tree as $v)
134134
}
135135
else if ($v instanceof \DCarbone\PHPConsulAPI\KV\KVPair)
136136
{
137-
echo '<li>'.$v->getKey().'</li>';
137+
echo '<li>'.$v->Key.': '.$v->Value.'</li>';
138138
}
139139
}
140140
echo '</ul>';

src/Hydrator.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,10 @@ class Hydrator
4747
*/
4848
public static function KVPair(array $data)
4949
{
50-
$kvp = new KVPair();
51-
foreach($data as $k => $v)
52-
{
53-
if ('Value' === $k)
54-
$kvp->Value = base64_decode($v);
55-
else
56-
$kvp->{$k} = $v;
57-
}
50+
if (isset($data['Value']))
51+
$data['Value'] = base64_decode($data['Value']);
5852

59-
return $kvp;
53+
return new KVPair($data);
6054
}
6155

6256
/**

0 commit comments

Comments
 (0)