1 | <?php namespace Arcanedev\Settings\Stores; |
||
15 | class JsonStore extends Store implements StoreContract |
||
16 | { |
||
17 | /* ------------------------------------------------------------------------------------------------ |
||
18 | | Properties |
||
19 | | ------------------------------------------------------------------------------------------------ |
||
20 | */ |
||
21 | /** |
||
22 | * The json file path. |
||
23 | * |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $path; |
||
27 | |||
28 | /* ------------------------------------------------------------------------------------------------ |
||
29 | | Constructor |
||
30 | | ------------------------------------------------------------------------------------------------ |
||
31 | */ |
||
32 | /** |
||
33 | * Make the Json store instance. |
||
34 | * |
||
35 | * @param \Illuminate\Filesystem\Filesystem $files |
||
36 | * @param string $path |
||
37 | */ |
||
38 | 36 | public function __construct(Filesystem $files, $path = null) |
|
43 | |||
44 | /* ------------------------------------------------------------------------------------------------ |
||
45 | | Getters & Setters |
||
46 | | ------------------------------------------------------------------------------------------------ |
||
47 | */ |
||
48 | /** |
||
49 | * Set the path for the JSON file. |
||
50 | * |
||
51 | * @param string $path |
||
52 | * |
||
53 | * @return self |
||
54 | */ |
||
55 | 36 | public function setPath($path) |
|
72 | |||
73 | /* ------------------------------------------------------------------------------------------------ |
||
74 | | Other Functions |
||
75 | | ------------------------------------------------------------------------------------------------ |
||
76 | */ |
||
77 | /** |
||
78 | * {@inheritdoc} |
||
79 | */ |
||
80 | 24 | protected function read() |
|
92 | |||
93 | /** |
||
94 | * {@inheritdoc} |
||
95 | */ |
||
96 | 15 | protected function write(array $data) |
|
102 | } |
||
103 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: