Total Complexity | 4 |
Total Lines | 35 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
29 | class Json extends Lorem |
||
30 | { |
||
31 | /** |
||
32 | * Generate a json list containing words |
||
33 | * |
||
34 | * @example ["ut", "eaque", "rerum", "voluptatem"] |
||
35 | * @param integer $nb how many words to return |
||
36 | * @return array|string |
||
37 | */ |
||
38 | public static function jsonWordsList($nb = 3) |
||
39 | { |
||
40 | $words = []; |
||
41 | for ($i=0; $i < $nb; $i++) { |
||
42 | $words []= static::word(); |
||
43 | } |
||
44 | |||
45 | return json_encode($words); |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * Generate a json containing words as an object |
||
50 | * |
||
51 | * @example ["ut", "eaque", "rerum", "voluptatem"] |
||
52 | * @param integer $nb how many words to return |
||
53 | * @return array|string |
||
54 | */ |
||
55 | public static function jsonWordsObject($nb = 3) |
||
64 | } |
||
65 | } |
||
66 |