atelierspierrot/patterns

View on GitHub
phpdoc/Patterns/Commons/Registry.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\Registry | 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_Registry" 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>Registry</li>
            </ol>
        </div>
                <div id="page-content">
                
    <div class="page-header">
        <h1>Registry</h1>
    </div>

    <p>    class
    <strong>Registry</strong>
</p>

            <div class="description">
            <p>A classic registry manager</p>            <p>This class handles a set of registries (array of <code>key=&gt;value</code> pairs) distinguishing
current working registry from old ones or others. Old ones or others are stored in
a stack of registries and can be loaded as the current one (replacing it).</p>        </div>
    
    
    
    
            <h2>Methods</h2>

            <div class="container-fluid underlined">
                    <div class="row">
                <div class="col-md-2 type">
                    
    array
                </div>
                <div class="col-md-8 type">
                    <a href="#method_dump">dump</a>()
                                            <p>Get current registry</p>                </div>
                <div class="col-md-2"></div>
            </div>
                    <div class="row">
                <div class="col-md-2 type">
                    
    void
                </div>
                <div class="col-md-8 type">
                    <a href="#method___set">__set</a>(
    string $var = null, 
    mixed $val = null)
                                            <p>Set an entry in the instance registry (magic setter)</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 $var = null)
                                            <p>Get an entry from the instance registry (magic getter)</p>                </div>
                <div class="col-md-2"></div>
            </div>
                    <div class="row">
                <div class="col-md-2 type">
                    
    <a href="../../Patterns/Commons/Registry.html"><abbr title="Patterns\Commons\Registry">Registry</abbr></a>
                </div>
                <div class="col-md-8 type">
                    <a href="#method_setEntry">setEntry</a>(
    null|string $var = null, 
    null|mixed $val = null, 
    <abbr title="Patterns\Commons\false">false</abbr>|string $section = false)
                                            <p>Set an entry in the instance registry</p>                </div>
                <div class="col-md-2"></div>
            </div>
                    <div class="row">
                <div class="col-md-2 type">
                    
    <a href="../../Patterns/Commons/Registry.html"><abbr title="Patterns\Commons\Registry">Registry</abbr></a>
                </div>
                <div class="col-md-8 type">
                    <a href="#method_addEntry">addEntry</a>(
    mixed $val = null, 
    string $section = false)
                                            <p>Add an entry in a section of the instance registry</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_getEntry">getEntry</a>(
    string $var = null, 
    string $section = false, 
    mixed $default = null)
                                            <p>Get an entry from the instance registry</p>                </div>
                <div class="col-md-2"></div>
            </div>
                    <div class="row">
                <div class="col-md-2 type">
                    
    bool
                </div>
                <div class="col-md-8 type">
                    <a href="#method_isEntry">isEntry</a>(
    string $var = null, 
    string $section = false)
                                            <p>Check if an entry exists in registry</p>                </div>
                <div class="col-md-2"></div>
            </div>
                    <div class="row">
                <div class="col-md-2 type">
                    
    string|null
                </div>
                <div class="col-md-8 type">
                    <a href="#method_getKey">getKey</a>(
    mixed $val = null, 
    string $var = null, 
    string $section = false)
                                            <p>Search a key in registry</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_dumpStack">dumpStack</a>(
    string $index = null, 
    mixed $default = null)
                                            <p>Get a full stack from registry stacks</p>                </div>
                <div class="col-md-2"></div>
            </div>
                    <div class="row">
                <div class="col-md-2 type">
                    
    <a href="../../Patterns/Commons/Registry.html"><abbr title="Patterns\Commons\Registry">Registry</abbr></a>
                </div>
                <div class="col-md-8 type">
                    <a href="#method_saveStack">saveStack</a>(
    string $index = null, 
    bool $and_clean = false)
                                            <p>Save a stack of entries in registry</p>                </div>
                <div class="col-md-2"></div>
            </div>
                    <div class="row">
                <div class="col-md-2 type">
                    
    bool
                </div>
                <div class="col-md-8 type">
                    <a href="#method_isStack">isStack</a>(
    string $index = null)
                                            <p>Check if a stack exists in registry</p>                </div>
                <div class="col-md-2"></div>
            </div>
                    <div class="row">
                <div class="col-md-2 type">
                    
    <a href="../../Patterns/Commons/Registry.html"><abbr title="Patterns\Commons\Registry">Registry</abbr></a>
                </div>
                <div class="col-md-8 type">
                    <a href="#method_loadStack">loadStack</a>(
    string $index = null)
                                            <p>Load a stack in registry (actual registry is overwrites)</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_getStackEntry">getStackEntry</a>(
    string $var = null, 
    string $section = false, 
    string $stack = null, 
    mixed $default = null)
                                            <p>Get a stack entry of the registry stacks</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_getStackKey">getStackKey</a>(
    string $val = null, 
    string $section = false, 
    string $stack = null, 
    mixed $default = null)
                                            <p>Get the key of a stack entry of the registry stacks</p>                </div>
                <div class="col-md-2"></div>
            </div>
            </div>


        <h2>Details</h2>

            <div id="method-details">
                    <div class="method-item">
                    <h3 id="method_dump">
        <div class="location">at line 56</div>
        <code>                    
    array
    <strong>dump</strong>()</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Get current registry</p>                                </div>
                <div class="tags">
            
                            <h4>Return Value</h4>

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

            
            
                    </div>
    </div>

            </div>
                    <div class="method-item">
                    <h3 id="method___set">
        <div class="location">at line 73</div>
        <code>                    
    void
    <strong>__set</strong>(
    string $var = null, 
    mixed $val = null)</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Set an entry in the instance registry (magic setter)</p>                    <p>This method is "magic" and will be called by PHP when an object's property
is defined like <code>$obj-&gt;prop = value</code> ; concerned property will be automatically
added to the registry.</p>            </div>
                <div class="tags">
                            <h4>Parameters</h4>

                    <table class="table table-condensed">
                    <tr>
                <td>
    string</td>
                <td>$var</td>
                <td>The variable name to set</td>
            </tr>
                    <tr>
                <td>
    mixed</td>
                <td>$val</td>
                <td>The variable value to set</td>
            </tr>
            </table>

            
                            <h4>Return Value</h4>

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

            
            
                            <h4>See also</h4>

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

                    </div>
    </div>

            </div>
                    <div class="method-item">
                    <h3 id="method___get">
        <div class="location">at line 89</div>
        <code>                    
    mixed
    <strong>__get</strong>(
    string $var = null)</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Get an entry from the instance registry (magic getter)</p>                    <p>This method is "magic" and will be called by PHP when an object's property
is accessed like <code>$obj-&gt;prop</code> ; concerned property will be returned if it
exists in the registry.</p>            </div>
                <div class="tags">
                            <h4>Parameters</h4>

                    <table class="table table-condensed">
                    <tr>
                <td>
    string</td>
                <td>$var</td>
                <td>The variable name to get</td>
            </tr>
            </table>

            
                            <h4>Return Value</h4>

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

            
            
                            <h4>See also</h4>

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

                    </div>
    </div>

            </div>
                    <div class="method-item">
                    <h3 id="method_setEntry">
        <div class="location">at line 102</div>
        <code>                    
    <a href="../../Patterns/Commons/Registry.html"><abbr title="Patterns\Commons\Registry">Registry</abbr></a>
    <strong>setEntry</strong>(
    null|string $var = null, 
    null|mixed $val = null, 
    <abbr title="Patterns\Commons\false">false</abbr>|string $section = false)</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Set an entry in the instance registry</p>                                </div>
                <div class="tags">
                            <h4>Parameters</h4>

                    <table class="table table-condensed">
                    <tr>
                <td>
    null|string</td>
                <td>$var</td>
                <td>The variable name to set</td>
            </tr>
                    <tr>
                <td>
    null|mixed</td>
                <td>$val</td>
                <td>The variable value to set</td>
            </tr>
                    <tr>
                <td>
    <abbr title="Patterns\Commons\false">false</abbr>|string</td>
                <td>$section</td>
                <td>A section name in the registry (default is FALSE)</td>
            </tr>
            </table>

            
                            <h4>Return Value</h4>

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

            
            
                    </div>
    </div>

            </div>
                    <div class="method-item">
                    <h3 id="method_addEntry">
        <div class="location">at line 124</div>
        <code>                    
    <a href="../../Patterns/Commons/Registry.html"><abbr title="Patterns\Commons\Registry">Registry</abbr></a>
    <strong>addEntry</strong>(
    mixed $val = null, 
    string $section = false)</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Add an entry in a section of the instance registry</p>                                </div>
                <div class="tags">
                            <h4>Parameters</h4>

                    <table class="table table-condensed">
                    <tr>
                <td>
    mixed</td>
                <td>$val</td>
                <td>The variable value to set</td>
            </tr>
                    <tr>
                <td>
    string</td>
                <td>$section</td>
                <td>A section name in the registry</td>
            </tr>
            </table>

            
                            <h4>Return Value</h4>

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

            
            
                    </div>
    </div>

            </div>
                    <div class="method-item">
                    <h3 id="method_getEntry">
        <div class="location">at line 143</div>
        <code>                    
    mixed
    <strong>getEntry</strong>(
    string $var = null, 
    string $section = false, 
    mixed $default = null)</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Get an entry from the instance registry</p>                                </div>
                <div class="tags">
                            <h4>Parameters</h4>

                    <table class="table table-condensed">
                    <tr>
                <td>
    string</td>
                <td>$var</td>
                <td>The variable name to get</td>
            </tr>
                    <tr>
                <td>
    string</td>
                <td>$section</td>
                <td>A section name in the registry (default is FALSE)</td>
            </tr>
                    <tr>
                <td>
    mixed</td>
                <td>$default</td>
                <td>The default value to return if it is not in registry (default is NULL)</td>
            </tr>
            </table>

            
                            <h4>Return Value</h4>

                    <table class="table table-condensed">
        <tr>
            <td>
    mixed</td>
            <td>The value found or $default</td>
        </tr>
    </table>

            
            
                    </div>
    </div>

            </div>
                    <div class="method-item">
                    <h3 id="method_isEntry">
        <div class="location">at line 162</div>
        <code>                    
    bool
    <strong>isEntry</strong>(
    string $var = null, 
    string $section = false)</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Check if an entry exists in registry</p>                                </div>
                <div class="tags">
                            <h4>Parameters</h4>

                    <table class="table table-condensed">
                    <tr>
                <td>
    string</td>
                <td>$var</td>
                <td>The variable name to check</td>
            </tr>
                    <tr>
                <td>
    string</td>
                <td>$section</td>
                <td>A section name in the registry (default is FALSE)</td>
            </tr>
            </table>

            
                            <h4>Return Value</h4>

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

            
            
                    </div>
    </div>

            </div>
                    <div class="method-item">
                    <h3 id="method_getKey">
        <div class="location">at line 180</div>
        <code>                    
    string|null
    <strong>getKey</strong>(
    mixed $val = null, 
    string $var = null, 
    string $section = false)</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Search a key in registry</p>                                </div>
                <div class="tags">
                            <h4>Parameters</h4>

                    <table class="table table-condensed">
                    <tr>
                <td>
    mixed</td>
                <td>$val</td>
                <td>The variable value to find</td>
            </tr>
                    <tr>
                <td>
    string</td>
                <td>$var</td>
                <td>The variable name to search in (in case of array)</td>
            </tr>
                    <tr>
                <td>
    string</td>
                <td>$section</td>
                <td>A section name in the registry (default is FALSE)</td>
            </tr>
            </table>

            
                            <h4>Return Value</h4>

                    <table class="table table-condensed">
        <tr>
            <td>
    string|null</td>
            <td>The key found in the registry</td>
        </tr>
    </table>

            
            
                    </div>
    </div>

            </div>
                    <div class="method-item">
                    <h3 id="method_dumpStack">
        <div class="location">at line 208</div>
        <code>                    
    mixed
    <strong>dumpStack</strong>(
    string $index = null, 
    mixed $default = null)</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Get a full stack from registry stacks</p>                                </div>
                <div class="tags">
                            <h4>Parameters</h4>

                    <table class="table table-condensed">
                    <tr>
                <td>
    string</td>
                <td>$index</td>
                <td>The stack index</td>
            </tr>
                    <tr>
                <td>
    mixed</td>
                <td>$default</td>
                <td>The default value to return if it is not in registry (default is NULL)</td>
            </tr>
            </table>

            
                            <h4>Return Value</h4>

                    <table class="table table-condensed">
        <tr>
            <td>
    mixed</td>
            <td>The requested stack entry if so</td>
        </tr>
    </table>

            
            
                    </div>
    </div>

            </div>
                    <div class="method-item">
                    <h3 id="method_saveStack">
        <div class="location">at line 223</div>
        <code>                    
    <a href="../../Patterns/Commons/Registry.html"><abbr title="Patterns\Commons\Registry">Registry</abbr></a>
    <strong>saveStack</strong>(
    string $index = null, 
    bool $and_clean = false)</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Save a stack of entries in registry</p>                                </div>
                <div class="tags">
                            <h4>Parameters</h4>

                    <table class="table table-condensed">
                    <tr>
                <td>
    string</td>
                <td>$index</td>
                <td>The stack index</td>
            </tr>
                    <tr>
                <td>
    bool</td>
                <td>$and_clean</td>
                <td>Clean the actual registry after recorded the stack (default is FALSE)</td>
            </tr>
            </table>

            
                            <h4>Return Value</h4>

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

            
            
                    </div>
    </div>

            </div>
                    <div class="method-item">
                    <h3 id="method_isStack">
        <div class="location">at line 238</div>
        <code>                    
    bool
    <strong>isStack</strong>(
    string $index = null)</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Check if a stack exists in registry</p>                                </div>
                <div class="tags">
                            <h4>Parameters</h4>

                    <table class="table table-condensed">
                    <tr>
                <td>
    string</td>
                <td>$index</td>
                <td>The stack index</td>
            </tr>
            </table>

            
                            <h4>Return Value</h4>

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

            
            
                    </div>
    </div>

            </div>
                    <div class="method-item">
                    <h3 id="method_loadStack">
        <div class="location">at line 249</div>
        <code>                    
    <a href="../../Patterns/Commons/Registry.html"><abbr title="Patterns\Commons\Registry">Registry</abbr></a>
    <strong>loadStack</strong>(
    string $index = null)</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Load a stack in registry (actual registry is overwrites)</p>                                </div>
                <div class="tags">
                            <h4>Parameters</h4>

                    <table class="table table-condensed">
                    <tr>
                <td>
    string</td>
                <td>$index</td>
                <td>The stack index</td>
            </tr>
            </table>

            
                            <h4>Return Value</h4>

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

            
            
                    </div>
    </div>

            </div>
                    <div class="method-item">
                    <h3 id="method_getStackEntry">
        <div class="location">at line 264</div>
        <code>                    
    mixed
    <strong>getStackEntry</strong>(
    string $var = null, 
    string $section = false, 
    string $stack = null, 
    mixed $default = null)</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Get a stack entry of the registry stacks</p>                                </div>
                <div class="tags">
                            <h4>Parameters</h4>

                    <table class="table table-condensed">
                    <tr>
                <td>
    string</td>
                <td>$var</td>
                <td>The variable name to search</td>
            </tr>
                    <tr>
                <td>
    string</td>
                <td>$section</td>
                <td>A section name in the registry (default is FALSE)</td>
            </tr>
                    <tr>
                <td>
    string</td>
                <td>$stack</td>
                <td>The stack name to search in</td>
            </tr>
                    <tr>
                <td>
    mixed</td>
                <td>$default</td>
                <td>The default value to return if it is not in registry (default is NULL)</td>
            </tr>
            </table>

            
                            <h4>Return Value</h4>

                    <table class="table table-condensed">
        <tr>
            <td>
    mixed</td>
            <td>The value found or $default</td>
        </tr>
    </table>

            
            
                    </div>
    </div>

            </div>
                    <div class="method-item">
                    <h3 id="method_getStackKey">
        <div class="location">at line 287</div>
        <code>                    
    mixed
    <strong>getStackKey</strong>(
    string $val = null, 
    string $section = false, 
    string $stack = null, 
    mixed $default = null)</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Get the key of a stack entry of the registry stacks</p>                                </div>
                <div class="tags">
                            <h4>Parameters</h4>

                    <table class="table table-condensed">
                    <tr>
                <td>
    string</td>
                <td>$val</td>
                <td>The variable value to search</td>
            </tr>
                    <tr>
                <td>
    string</td>
                <td>$section</td>
                <td>A section name in the registry (default is FALSE)</td>
            </tr>
                    <tr>
                <td>
    string</td>
                <td>$stack</td>
                <td>The stack name to search in</td>
            </tr>
                    <tr>
                <td>
    mixed</td>
                <td>$default</td>
                <td>The default value to return if it is not in registry (default is NULL)</td>
            </tr>
            </table>

            
                            <h4>Return Value</h4>

                    <table class="table table-condensed">
        <tr>
            <td>
    mixed</td>
            <td>The key found or $default</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>