WritableConfiguration.php
1 <?php
2 /**
3  * wCMF - wemove Content Management Framework
4  * Copyright (C) 2005-2020 wemove digital solutions GmbH
5  *
6  * Licensed under the terms of the MIT License.
7  *
8  * See the LICENSE file distributed with this work for
9  * additional information.
10  */
11 namespace wcmf\lib\config;
12 
13 /**
14  * Implementations of WritableConfiguration allow to change the
15  * whole or parts of the configuration and persist the changes.
16  *
17  * @author ingo herwig <ingo@wemove.com>
18  */
20 
21  /**
22  * Check if a section is editable.
23  * @param $section The name of the section.
24  * @return Boolean
25  */
26  public function isEditable($section);
27 
28  /**
29  * Check if the configuration is modified.
30  * @return Boolean
31  */
32  public function isModified();
33 
34  /**
35  * Create a section.
36  * @param $section The name of the section (will be trimmed).
37  * @throws IllegalArgumentException if section exists or the name is empty
38  */
39  public function createSection($section);
40 
41  /**
42  * Remove a section.
43  * @param $section The name of the section.
44  * @throws IllegalArgumentException if section is not editable
45  */
46  public function removeSection($section);
47 
48  /**
49  * Rename a section.
50  * @param $oldname The name of the section.
51  * @param $newname The new name of the section (will be trimmed).
52  * @throws IllegalArgumentException if old section does not exist or is not editable,
53  * if new section already exists or name is empty
54  */
55  public function renameSection($oldname, $newname);
56 
57  /**
58  * Create a key/value pair in a section.
59  * @param $key The name of the key (will be trimmed).
60  * @param $value The value of the key.
61  * @param $section The name of the section.
62  * @param $createSection The name of the section.
63  * @throws IllegalArgumentException if section does not exist and should not be created
64  * or is not editable or key is empty
65  */
66  public function setValue($key, $value, $section, $createSection=true);
67 
68  /**
69  * Remove a key from a section.
70  * @param $key The name of the key.
71  * @param $section The name of the section.
72  * @throws IllegalArgumentException if section is not editable
73  */
74  public function removeKey($key, $section);
75 
76  /**
77  * Rename a key in a section.
78  * @param $oldname The name of the section.
79  * @param $newname The new name of the section (will be trimmed).
80  * @param $section The name of the section.
81  * @throws IllegalArgumentException if section is not editable or does not
82  * exist or the old key does not exist or the new key already exists or is empty
83  */
84  public function renameKey($oldname, $newname, $section);
85 
86  /**
87  * Persist the configuration changes.
88  * @param $name The name of the configuration to write.
89  * @throws IOException
90  */
91  public function writeConfiguration($name);
92 }
93 ?>
Implementations of WritableConfiguration allow to change the whole or parts of the configuration and ...
renameKey($oldname, $newname, $section)
Rename a key in a section.
setValue($key, $value, $section, $createSection=true)
Create a key/value pair in a section.
isModified()
Check if the configuration is modified.
isEditable($section)
Check if a section is editable.
removeSection($section)
Remove a section.
createSection($section)
Create a section.
renameSection($oldname, $newname)
Rename a section.
Configuration related interfaces and classes.
Definition: namespaces.php:6
removeKey($key, $section)
Remove a key from a section.
writeConfiguration($name)
Persist the configuration changes.