atelierspierrot/patterns

View on GitHub
phpdoc/Patterns/Commons/ConfigurationRegistry.html

Summary

Maintainability
Test Coverage
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <meta name="robots" content="index, follow, all" />
    <title>Patterns\Commons\ConfigurationRegistry | Patterns</title>

            <link rel="stylesheet" type="text/css" href="../../css/bootstrap.min.css">
        <link rel="stylesheet" type="text/css" href="../../css/bootstrap-theme.min.css">
        <link rel="stylesheet" type="text/css" href="../../css/sami.css">
        <script src="../../js/jquery-1.11.1.min.js"></script>
        <script src="../../js/bootstrap.min.js"></script>
        <script src="../../js/typeahead.min.js"></script>
        <script src="../../sami.js"></script>
        <meta name="MobileOptimized" content="width">
        <meta name="HandheldFriendly" content="true">
        <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
    
    
    </head>

    <body id="class" data-name="class:Patterns_Commons_ConfigurationRegistry" data-root-path="../../">
            <div id="content">
        <div id="left-column">
                <div id="control-panel">
                <form id="search-form" action="../../search.html" method="GET">
            <span class="glyphicon glyphicon-search"></span>
            <input name="search"
                   class="typeahead form-control"
                   type="search"
                   placeholder="Search">
        </form>
    </div>

                <div id="api-tree"></div>

        </div>
        <div id="right-column">
                <nav id="site-nav" class="navbar navbar-default" role="navigation">
        <div class="container-fluid">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-elements">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="../../index.html">Patterns</a>
            </div>
            <div class="collapse navbar-collapse" id="navbar-elements">
                <ul class="nav navbar-nav">
                    <li><a href="../../classes.html">Classes</a></li>
                                            <li><a href="../../namespaces.html">Namespaces</a></li>
                                        <li><a href="../../interfaces.html">Interfaces</a></li>
                    <li><a href="../../traits.html">Traits</a></li>
                    <li><a href="../../doc-index.html">Index</a></li>
                    <li><a href="../../search.html">Search</a></li>
                </ul>
            </div>
        </div>
    </nav>

                        <div class="namespace-breadcrumbs">
            <ol class="breadcrumb">
                <li><span class="label label-default">class</span></li>
                                                            <li><a href="../../Patterns.html">Patterns</a></li>
                                        <li><a href="../../Patterns/Commons.html">Commons</a></li>
    
                <li>ConfigurationRegistry</li>
            </ol>
        </div>
                <div id="page-content">
                
    <div class="page-header">
        <h1>ConfigurationRegistry</h1>
    </div>

    <p>    class
    <strong>ConfigurationRegistry</strong>
</p>

            <div class="description">
            <p>A manager for a configuration registry as an array with a depth of 2</p>            <p>This class handles a simple and classic registry of values (stored in an array
as <code>key=&gt;value</code> pairs) except that it accepts and manages the first depth keys
of the array like a <code>scope</code> and permits to access values within scopes directly.</p>

<p>The rule here is that when you used to call <code>$obj-&gt;get(property)</code> you can now call
<code>$obj-&gt;get(scope:property)</code> ; this is very useful for configuration entries, that
are often stored in complex arrays identified by a simple key.</p>        </div>
    
    
    
    
            <h2>Methods</h2>

            <div class="container-fluid underlined">
                    <div class="row">
                <div class="col-md-2 type">
                    
    
                </div>
                <div class="col-md-8 type">
                    <a href="#method___construct">__construct</a>()
                                            <p>Construction : initialization of the registry on an empty array</p>                </div>
                <div class="col-md-2"></div>
            </div>
                    <div class="row">
                <div class="col-md-2 type">
                    
    <a href="../../Patterns/Commons/ConfigurationRegistry.html"><abbr title="Patterns\Commons\ConfigurationRegistry">ConfigurationRegistry</abbr></a>
                </div>
                <div class="col-md-8 type">
                    <a href="#method_set">set</a>(
    string $name, 
    mixed $value, 
    string $scope = null)
                                            <p>Set the value of a specific option with depth</p>                </div>
                <div class="col-md-2"></div>
            </div>
                    <div class="row">
                <div class="col-md-2 type">
                    
    mixed
                </div>
                <div class="col-md-8 type">
                    <a href="#method_get">get</a>(
    string $name, 
    mixed $default = null, 
    string $scope = null)
                                            <p>Get the value of a specific option with depth</p>                </div>
                <div class="col-md-2"></div>
            </div>
                    <div class="row">
                <div class="col-md-2 type">
                    
    <a href="../../Patterns/Commons/ConfigurationRegistry.html"><abbr title="Patterns\Commons\ConfigurationRegistry">ConfigurationRegistry</abbr></a>
                </div>
                <div class="col-md-8 type">
                    <a href="#method_setConfigs">setConfigs</a>(
    array $options, 
    string $scope = null)
                                            <p>Set an array of options</p>                </div>
                <div class="col-md-2"></div>
            </div>
                    <div class="row">
                <div class="col-md-2 type">
                    
    <a href="../../Patterns/Commons/ConfigurationRegistry.html"><abbr title="Patterns\Commons\ConfigurationRegistry">ConfigurationRegistry</abbr></a>
                </div>
                <div class="col-md-8 type">
                    <a href="#method_setConfig">setConfig</a>(
    string $name, 
    mixed $value, 
    string $scope = null)
                                            <p>Set the value of a specific option (no scope notation allowed here)</p>                </div>
                <div class="col-md-2"></div>
            </div>
                    <div class="row">
                <div class="col-md-2 type">
                    
    
                </div>
                <div class="col-md-8 type">
                    <a href="#method_addConfig">addConfig</a>($name, $value, $scope = null)
                                            <p>Alias of the <code>setConfig</code> method</p>                </div>
                <div class="col-md-2"></div>
            </div>
                    <div class="row">
                <div class="col-md-2 type">
                    
    array|mixed|null
                </div>
                <div class="col-md-8 type">
                    <a href="#method_getConfigs">getConfigs</a>(
    mixed $default = null, 
    string $scope = null)
                                            <p>Get the array of options (from a specific scope if so)</p>                </div>
                <div class="col-md-2"></div>
            </div>
                    <div class="row">
                <div class="col-md-2 type">
                    
    mixed
                </div>
                <div class="col-md-8 type">
                    <a href="#method_getConfig">getConfig</a>(
    string $name, 
    mixed $default = null, 
    string $scope = null)
                                            <p>Get the value of a specific option (no scope notation allowed here)</p>                </div>
                <div class="col-md-2"></div>
            </div>
            </div>


        <h2>Details</h2>

            <div id="method-details">
                    <div class="method-item">
                    <h3 id="method___construct">
        <div class="location">at line 49</div>
        <code>                    
    
    <strong>__construct</strong>()</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Construction : initialization of the registry on an empty array</p>                                </div>
                <div class="tags">
            
            
            
                    </div>
    </div>

            </div>
                    <div class="method-item">
                    <h3 id="method_set">
        <div class="location">at line 62</div>
        <code>                    
    <a href="../../Patterns/Commons/ConfigurationRegistry.html"><abbr title="Patterns\Commons\ConfigurationRegistry">ConfigurationRegistry</abbr></a>
    <strong>set</strong>(
    string $name, 
    mixed $value, 
    string $scope = null)</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Set the value of a specific option with depth</p>                                </div>
                <div class="tags">
                            <h4>Parameters</h4>

                    <table class="table table-condensed">
                    <tr>
                <td>
    string</td>
                <td>$name</td>
                <td>The index of the configuration value to get, with a scope using notation <code>index:name</code></td>
            </tr>
                    <tr>
                <td>
    mixed</td>
                <td>$value</td>
                <td>The value to set for $name</td>
            </tr>
                    <tr>
                <td>
    string</td>
                <td>$scope</td>
                <td>The scope to use in the configuration registry if it is not defined in the <code>$name</code> parameter</td>
            </tr>
            </table>

            
                            <h4>Return Value</h4>

                    <table class="table table-condensed">
        <tr>
            <td>
    <a href="../../Patterns/Commons/ConfigurationRegistry.html"><abbr title="Patterns\Commons\ConfigurationRegistry">ConfigurationRegistry</abbr></a></td>
            <td>
</td>
        </tr>
    </table>

            
            
                    </div>
    </div>

            </div>
                    <div class="method-item">
                    <h3 id="method_get">
        <div class="location">at line 82</div>
        <code>                    
    mixed
    <strong>get</strong>(
    string $name, 
    mixed $default = null, 
    string $scope = null)</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Get the value of a specific option with depth</p>                                </div>
                <div class="tags">
                            <h4>Parameters</h4>

                    <table class="table table-condensed">
                    <tr>
                <td>
    string</td>
                <td>$name</td>
                <td>The index of the configuration value to get, with a scope using notation <code>index:name</code></td>
            </tr>
                    <tr>
                <td>
    mixed</td>
                <td>$default</td>
                <td>The default value to return if so (<code>null</code> by default)</td>
            </tr>
                    <tr>
                <td>
    string</td>
                <td>$scope</td>
                <td>The scope to use in the configuration registry if it is not defined in the <code>$name</code> parameter</td>
            </tr>
            </table>

            
                            <h4>Return Value</h4>

                    <table class="table table-condensed">
        <tr>
            <td>
    mixed</td>
            <td>The value retrieved in the registry or the default value otherwise</td>
        </tr>
    </table>

            
            
                    </div>
    </div>

            </div>
                    <div class="method-item">
                    <h3 id="method_setConfigs">
        <div class="location">at line 100</div>
        <code>                    
    <a href="../../Patterns/Commons/ConfigurationRegistry.html"><abbr title="Patterns\Commons\ConfigurationRegistry">ConfigurationRegistry</abbr></a>
    <strong>setConfigs</strong>(
    array $options, 
    string $scope = null)</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Set an array of options</p>                                </div>
                <div class="tags">
                            <h4>Parameters</h4>

                    <table class="table table-condensed">
                    <tr>
                <td>
    array</td>
                <td>$options</td>
                <td>The array of values to set for the configuration entry</td>
            </tr>
                    <tr>
                <td>
    string</td>
                <td>$scope</td>
                <td>The scope to use in the configuration registry (optional)</td>
            </tr>
            </table>

            
                            <h4>Return Value</h4>

                    <table class="table table-condensed">
        <tr>
            <td>
    <a href="../../Patterns/Commons/ConfigurationRegistry.html"><abbr title="Patterns\Commons\ConfigurationRegistry">ConfigurationRegistry</abbr></a></td>
            <td>
</td>
        </tr>
    </table>

            
            
                    </div>
    </div>

            </div>
                    <div class="method-item">
                    <h3 id="method_setConfig">
        <div class="location">at line 119</div>
        <code>                    
    <a href="../../Patterns/Commons/ConfigurationRegistry.html"><abbr title="Patterns\Commons\ConfigurationRegistry">ConfigurationRegistry</abbr></a>
    <strong>setConfig</strong>(
    string $name, 
    mixed $value, 
    string $scope = null)</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Set the value of a specific option (no scope notation allowed here)</p>                                </div>
                <div class="tags">
                            <h4>Parameters</h4>

                    <table class="table table-condensed">
                    <tr>
                <td>
    string</td>
                <td>$name</td>
                <td>The index of the configuration value</td>
            </tr>
                    <tr>
                <td>
    mixed</td>
                <td>$value</td>
                <td>The value to set for the configuration entry</td>
            </tr>
                    <tr>
                <td>
    string</td>
                <td>$scope</td>
                <td>The scope to use in the configuration registry (optional)</td>
            </tr>
            </table>

            
                            <h4>Return Value</h4>

                    <table class="table table-condensed">
        <tr>
            <td>
    <a href="../../Patterns/Commons/ConfigurationRegistry.html"><abbr title="Patterns\Commons\ConfigurationRegistry">ConfigurationRegistry</abbr></a></td>
            <td>
</td>
        </tr>
    </table>

            
            
                    </div>
    </div>

            </div>
                    <div class="method-item">
                    <h3 id="method_addConfig">
        <div class="location">at line 138</div>
        <code>                    
    
    <strong>addConfig</strong>($name, $value, $scope = null)</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Alias of the <code>setConfig</code> method</p>                                </div>
                <div class="tags">
                            <h4>Parameters</h4>

                    <table class="table table-condensed">
                    <tr>
                <td></td>
                <td>$name</td>
                <td>
</td>
            </tr>
                    <tr>
                <td></td>
                <td>$value</td>
                <td>
</td>
            </tr>
                    <tr>
                <td></td>
                <td>$scope</td>
                <td>
</td>
            </tr>
            </table>

            
            
            
                            <h4>See also</h4>

                    <table class="table table-condensed">
                    <tr>
                <td>self::setConfig()</td>
                <td></td>
            </tr>
            </table>

                    </div>
    </div>

            </div>
                    <div class="method-item">
                    <h3 id="method_getConfigs">
        <div class="location">at line 150</div>
        <code>                    
    array|mixed|null
    <strong>getConfigs</strong>(
    mixed $default = null, 
    string $scope = null)</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Get the array of options (from a specific scope if so)</p>                                </div>
                <div class="tags">
                            <h4>Parameters</h4>

                    <table class="table table-condensed">
                    <tr>
                <td>
    mixed</td>
                <td>$default</td>
                <td>The default value to return if so (<code>null</code> by default)</td>
            </tr>
                    <tr>
                <td>
    string</td>
                <td>$scope</td>
                <td>The scope to use in the configuration registry (optional)</td>
            </tr>
            </table>

            
                            <h4>Return Value</h4>

                    <table class="table table-condensed">
        <tr>
            <td>
    array|mixed|null</td>
            <td>
</td>
        </tr>
    </table>

            
            
                    </div>
    </div>

            </div>
                    <div class="method-item">
                    <h3 id="method_getConfig">
        <div class="location">at line 166</div>
        <code>                    
    mixed
    <strong>getConfig</strong>(
    string $name, 
    mixed $default = null, 
    string $scope = null)</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Get the value of a specific option (no scope notation allowed here)</p>                                </div>
                <div class="tags">
                            <h4>Parameters</h4>

                    <table class="table table-condensed">
                    <tr>
                <td>
    string</td>
                <td>$name</td>
                <td>The index of the configuration value to get</td>
            </tr>
                    <tr>
                <td>
    mixed</td>
                <td>$default</td>
                <td>The default value to return if so (<code>null</code> by default)</td>
            </tr>
                    <tr>
                <td>
    string</td>
                <td>$scope</td>
                <td>The scope to use in the configuration registry (optional)</td>
            </tr>
            </table>

            
                            <h4>Return Value</h4>

                    <table class="table table-condensed">
        <tr>
            <td>
    mixed</td>
            <td>
</td>
        </tr>
    </table>

            
            
                    </div>
    </div>

            </div>
            </div>

    
            </div>
                <div id="footer">
        Generated by <a href="http://sami.sensiolabs.org/">Sami, the API Documentation Generator</a>.
    </div>

        </div>
    </div>
    </body>

</html>