Json
last analyzed

Size/Duplication

Total Lines 143
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 143
c 0
b 0
f 0

14 Methods

Rating   Name   Duplication   Size   Complexity  
setFilesystem() 0 1 ?
getPath() 0 1 ?
setPath() 0 1 ?
attributes() 0 1 ?
decode() 0 1 ?
encode() 0 1 ?
make() 0 1 ?
fromContent() 0 1 ?
get() 0 1 ?
set() 0 1 ?
merge() 0 1 ?
update() 0 1 ?
save() 0 1 ?
toJsonPretty() 0 1 ?
1
<?php namespace Arcanedev\Json\Contracts;
2
3
use Illuminate\Filesystem\Filesystem;
4
5
/**
6
 * Interface  Json
7
 *
8
 * @package   Arcanedev\Json\Contracts
9
 * @author    ARCANEDEV <[email protected]>
10
 */
11
interface Json
12
{
13
    /* -----------------------------------------------------------------
14
     |  Getters & Setters
15
     | -----------------------------------------------------------------
16
     */
17
18
    /**
19
     * Set the filesystem instance.
20
     *
21
     * @param  \Illuminate\Filesystem\Filesystem  $filesystem
22
     *
23
     * @return static
24
     */
25
    public function setFilesystem(Filesystem $filesystem);
26
27
    /**
28
     * Get path.
29
     *
30
     * @return string
31
     */
32
    public function getPath();
33
34
    /**
35
     * Set path.
36
     *
37
     * @param  mixed  $path
38
     *
39
     * @return static
40
     */
41
    public function setPath($path);
42
43
    /**
44
     * Get file contents as Collection.
45
     *
46
     * @return \Illuminate\Support\Collection
47
     */
48
    public function attributes();
49
50
    /* -----------------------------------------------------------------
51
     |  Main Methods
52
     | -----------------------------------------------------------------
53
     */
54
55
    /**
56
     * Decode ths json content.
57
     *
58
     * @param  string  $content
59
     * @param  bool    $assoc
60
     * @param  int     $depth
61
     * @param  int     $options
62
     *
63
     * @return array
64
     */
65
    public static function decode($content, $assoc = true, $options = 0, $depth = 512);
66
67
    /**
68
     * Encode to json content.
69
     *
70
     * @param  mixed  $content
71
     * @param  int    $options
72
     * @param  int    $depth
73
     *
74
     * @return string
75
     */
76
    public function encode($content, $options = 0, $depth = 512);
77
78
    /**
79
     * Make new instance.
80
     *
81
     * @param  string                             $path
82
     * @param  \Illuminate\Filesystem\Filesystem  $filesystem
83
     *
84
     * @return static
85
     */
86
    public static function make($path, Filesystem $filesystem = null);
87
88
    /**
89
     * Load json content.
90
     *
91
     * @param  string  $content
92
     *
93
     * @return static
94
     */
95
    public static function fromContent($content);
96
97
    /**
98
     * Get the specified attribute from json file.
99
     *
100
     * @param  string      $key
101
     * @param  mixed|null  $default
102
     *
103
     * @return mixed
104
     */
105
    public function get($key, $default = null);
106
107
    /**
108
     * Set a specific key & value.
109
     *
110
     * @param  string  $key
111
     * @param  mixed   $value
112
     *
113
     * @return static
114
     */
115
    public function set($key, $value);
116
117
    /**
118
     * Merge json attributes with a given array items.
119
     *
120
     * @param  array  $items
121
     *
122
     * @return static
123
     */
124
    public function merge(array $items);
125
126
    /**
127
     * Update & save json contents from array items.
128
     *
129
     * @param  array   $items
130
     * @param  string  $path
131
     *
132
     * @return int
133
     */
134
    public function update(array $items, $path = null);
135
136
    /**
137
     * Save the current attributes array to the file storage.
138
     *
139
     * @param  string|null  $path
140
     *
141
     * @return int
142
     */
143
    public function save($path = null);
144
145
    /**
146
     * Convert the given array data to pretty json.
147
     *
148
     * @param  array  $data
149
     *
150
     * @return string
151
     */
152
    public function toJsonPretty(array $data = null);
153
}
154