2014-06-11 08:12:05 +00:00
|
|
|
<?php
|
|
|
|
namespace Westdc\Visual;
|
|
|
|
|
|
|
|
class VariableEncoder
|
|
|
|
{
|
|
|
|
|
|
|
|
function __construct()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public function __invoke($json)
|
|
|
|
{
|
|
|
|
$this->decode($json);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function encode($vars)
|
|
|
|
{
|
2014-12-22 06:25:58 +00:00
|
|
|
return json_encode($vars);
|
2014-06-11 08:12:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function decode($json)
|
|
|
|
{
|
|
|
|
$arr = json_decode($json,true);
|
2014-12-22 06:25:58 +00:00
|
|
|
return $arr;
|
2014-06-11 08:12:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function normaldecode($json)
|
|
|
|
{
|
|
|
|
return json_decode($json,true);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|