wCMF  3.6
 All Classes Namespaces Files Functions Variables Groups Pages
class.JSONUtil.php
Go to the documentation of this file.
1 <?php
2 /**
3  * wCMF - wemove Content Management Framework
4  * Copyright (C) 2005-2014 wemove digital solutions GmbH
5  *
6  * Licensed under the terms of any of the following licenses
7  * at your choice:
8  *
9  * - GNU Lesser General Public License (LGPL)
10  * http://www.gnu.org/licenses/lgpl.html
11  * - Eclipse Public License (EPL)
12  * http://www.eclipse.org/org/documents/epl-v10.php
13  *
14  * See the license.txt file distributed with this work for
15  * additional information.
16  *
17  * $Id: class.JSONUtil.php 1462 2014-02-04 23:52:27Z iherwig $
18  */
19 require_once(BASE."wcmf/lib/util/class.EncodingUtil.php");
20 
21 /**
22  * @class JSONUtil
23  * @ingroup Util
24  * @brief JSONUtil provides helper functions for JSON.
25  *
26  * @author ingo herwig <ingo@wemove.com>
27  */
28 class JSONUtil
29 {
30  /**
31  * Decode a value
32  * @param value The value to decode
33  * @param assoc True/False, wether to convert objects into associative arrays or not [default: false]
34  * @return The decoded value
35  */
36  static function decode($value, $assoc=false)
37  {
38  return json_decode($value, $assoc);
39  }
40 
41  /**
42  * Encode a value
43  * @param value The value to encode
44  * @return The encoded value
45  */
46  static function encode($value)
47  {
48  return json_encode($value);
49  }
50 }
51 ?>
static decode($value, $assoc=false)
JSONUtil provides helper functions for JSON.
static encode($value)