PropertiesInterface::mergeProperties()
last analyzed

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * \AppserverIo\Properties\PropertiesInterface
5
 *
6
 * NOTICE OF LICENSE
7
 *
8
 * This source file is subject to the Open Software License (OSL 3.0)
9
 * that is available through the world-wide-web at this URL:
10
 * http://opensource.org/licenses/osl-3.0.php
11
 *
12
 * PHP version 5
13
 *
14
 * @author    Tim Wagner <[email protected]>
15
 * @copyright 2015 TechDivision GmbH <[email protected]>
16
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
 * @link      http://github.com/appserver-io/properties
18
 * @link      http://www.appserver.io
19
 */
20
21
namespace AppserverIo\Properties;
22
23
use AppserverIo\Collections\MapInterface;
24
25
/**
26
 * The interface for all property implementations.
27
 *
28
 * @author    Tim Wagner <[email protected]>
29
 * @copyright 2015 TechDivision GmbH <[email protected]>
30
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
31
 * @link      http://github.com/appserver-io/properties
32
 * @link      http://www.appserver.io
33
 */
34
interface PropertiesInterface extends MapInterface
35
{
36
37
    /**
38
     * Reads a property list (key and element pairs) from the passed file.
39
     *
40
     * @param string  $file     The path and the name of the file to load the properties from
41
     * @param boolean $sections Has to be TRUE to parse the sections
42
     *
43
     * @return \AppserverIo\Properties\Properties The initialized properties
44
     * @throws \AppserverIo\Properties\PropertyFileParseException Is thrown if an error occurse while parsing the property file
45
     * @throws \AppserverIo\Properties\PropertyFileNotFoundException Is thrown if the property file passed as parameter does not exist in the include path
46
     */
47
    public function load($file, $sections = false);
48
49
    /**
50
     * Stores the properties in the property file. This method is NOT using the include path for storing the file.
51
     *
52
     * @param string $file The path and the name of the file to store the properties to
53
     *
54
     * @return void
55
     *
56
     * @throws \AppserverIo\Properties\PropertyFileStoreException Is thrown if the file could not be written
57
     * @todo Actually only properties without sections will be stored, if a section is specified, then it will be ignored
0 ignored issues
show
Coding Style introduced by
Comment refers to a TODO task

This check looks TODO comments that have been left in the code.

``TODO``s show that something is left unfinished and should be attended to.

Loading history...
58
     */
59
    public function store($file);
60
61
    /**
62
     * Searches for the property with the specified key in this property list.
63
     *
64
     * @param string $key     Holds the key of the value to return
65
     * @param string $section Holds a string with the section name to return the key for (only matters if sections is set to TRUE)
66
     *
67
     * @return string Holds the value of the passed key
68
     * @throws \AppserverIo\Lang\NullPointerException Is thrown if the passed key, or, if sections are TRUE, the passed section is NULL
69
     */
70
    public function getProperty($key, $section = null);
71
72
    /**
73
     * Calls the HashMap method add.
74
     *
75
     * @param string $key     Holds the key of the value to return
76
     * @param mixed  $value   Holds the value to add to the properties
77
     * @param string $section Holds a string with the section name to return the key for (only matters if sections is set to TRUE)
78
     *
79
     * @return void
80
     * @throws \AppserverIo\Lang\NullPointerException Is thrown if the passed key, or, if sections are TRUE, the passed section is NULL
81
     */
82
    public function setProperty($key, $value, $section = null);
83
84
    /**
85
     * Returns all key values as an array.
86
     *
87
     * @return array The keys as array values
88
     */
89
    public function getKeys();
90
91
    /**
92
     * Merges the passed properties into the actual instance. If override
93
     * flag is set to TRUE, existing properties will be overwritten.
94
     *
95
     * @param \AppserverIo\Properties\PropertiesInterface $properties The properties to merge
96
     * @param boolean                                     $override   TRUE if existing properties have to be overwritten, else FALSE
97
     *
98
     * @return void
99
     */
100
    public function mergeProperties(PropertiesInterface $properties, $override = false);
101
}
102