atelierspierrot/library

View on GitHub
phpdoc/Library/Reporter/Reporter.html

Summary

Maintainability
Test Coverage
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <meta name="robots" content="index, follow, all" />
    <title>Library\Reporter\Reporter | Library</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:Library_Reporter_Reporter" 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">Library</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="../../Library.html">Library</a></li>
                                        <li><a href="../../Library/Reporter.html">Reporter</a></li>
    
                <li>Reporter</li>
            </ol>
        </div>
                <div id="page-content">
                
    <div class="page-header">
        <h1>Reporter</h1>
    </div>

    <p>    class
    <strong>Reporter</strong>
</p>

    
    
            <h2>Constants</h2>

            <table class="table table-condensed">
                    <tr>
                <td>OUTPUT_BY_LINE</td>
                <td class="last">
                    <p><em>Set the reporter to return each output rendering</em></p>
                    <p>
</p>
                </td>
            </tr>
                    <tr>
                <td>OUTPUT_APPEND</td>
                <td class="last">
                    <p><em>Set the reporter to append each output rendering to a global output</em></p>
                    <p>
</p>
                </td>
            </tr>
            </table>

    
            <h2>Properties</h2>

            <table class="table table-condensed">
                    <tr>
                <td class="type" id="property_default_tag_types">
                    static                                                            
    array
                </td>
                <td>$default_tag_types</td>
                <td class="last">
</td>
                <td></td>
            </tr>
                    <tr>
                <td class="type" id="property_default_masks">
                    static                                                            
    array
                </td>
                <td>$default_masks</td>
                <td class="last">
</td>
                <td></td>
            </tr>
            </table>

    
            <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>(
    null|string $adapter_type = &#039;html&#039;, 
    int $flag = self::OUTPUT_BY_LINE)
                                            <p>Construction of a new Reporter object</p>                </div>
                <div class="col-md-2"></div>
            </div>
                    <div class="row">
                <div class="col-md-2 type">
                    
    <a href="../../Library/Reporter/Reporter.html"><abbr title="Library\Reporter\Reporter">Reporter</abbr></a>
                </div>
                <div class="col-md-8 type">
                    <a href="#method_reset">reset</a>(
    bool $hard = false)
                                            <p>Reset all object properties to default or empty values</p>                </div>
                <div class="col-md-2"></div>
            </div>
                    <div class="row">
                <div class="col-md-2 type">
                    
    string
                </div>
                <div class="col-md-8 type">
                    <a href="#method___toString">__toString</a>()
                                            <p>Returns the object global output</p>                </div>
                <div class="col-md-2"></div>
            </div>
                    <div class="row">
                <div class="col-md-2 type">
                    
    <a href="../../Library/Reporter/Reporter.html"><abbr title="Library\Reporter\Reporter">Reporter</abbr></a>
                </div>
                <div class="col-md-8 type">
                    <a href="#method_setFlag">setFlag</a>(
    int $flag)
                                            <p>Set the reporter flag</p>                </div>
                <div class="col-md-2"></div>
            </div>
                    <div class="row">
                <div class="col-md-2 type">
                    
    int
                </div>
                <div class="col-md-8 type">
                    <a href="#method_getFlag">getFlag</a>()
                                            <p>Get the reporter flag</p>                </div>
                <div class="col-md-2"></div>
            </div>
                    <div class="row">
                <div class="col-md-2 type">
                    
    <a href="../../Library/Reporter/Reporter.html"><abbr title="Library\Reporter\Reporter">Reporter</abbr></a>
                </div>
                <div class="col-md-8 type">
                    <a href="#method_setAdapterType">setAdapterType</a>(
    string $type)
                                            <p>Set the adapter type to use</p>                </div>
                <div class="col-md-2"></div>
            </div>
                    <div class="row">
                <div class="col-md-2 type">
                    
    object
                </div>
                <div class="col-md-8 type">
                    <a href="#method_getAdapterType">getAdapterType</a>()
                                            <p>Get the current adapter name</p>                </div>
                <div class="col-md-2"></div>
            </div>
                    <div class="row">
                <div class="col-md-2 type">
                    
    <a href="../../Library/Reporter/Reporter.html"><abbr title="Library\Reporter\Reporter">Reporter</abbr></a>
                </div>
                <div class="col-md-8 type">
                    <a href="#method_setAdapter">setAdapter</a>(
    <abbr title="Library\Reporter\Library\Reporter\AbstractAdapter">AbstractAdapter</abbr> $adapter)
                                            <p>Set the adapter</p>                </div>
                <div class="col-md-2"></div>
            </div>
                    <div class="row">
                <div class="col-md-2 type">
                    
    object
                </div>
                <div class="col-md-8 type">
                    <a href="#method_getAdapter">getAdapter</a>()
                                            <p>Get the current adapter</p>                </div>
                <div class="col-md-2"></div>
            </div>
                    <div class="row">
                <div class="col-md-2 type">
                    
    <a href="../../Library/Reporter/Reporter.html"><abbr title="Library\Reporter\Reporter">Reporter</abbr></a>
                </div>
                <div class="col-md-8 type">
                    <a href="#method_setOutput">setOutput</a>(
    string $output)
                                            <p>Set some content</p>                </div>
                <div class="col-md-2"></div>
            </div>
                    <div class="row">
                <div class="col-md-2 type">
                    
    string
                </div>
                <div class="col-md-8 type">
                    <a href="#method_getOutput">getOutput</a>()
                                            <p>Get the processed content</p>                </div>
                <div class="col-md-2"></div>
            </div>
                    <div class="row">
                <div class="col-md-2 type">
                    
    string|<a href="../../Library/Reporter/Reporter.html"><abbr title="Library\Reporter\Reporter">Reporter</abbr></a>
                </div>
                <div class="col-md-8 type">
                    <a href="#method_render">render</a>(
    string $content, 
    string $tag_type = &#039;default&#039;, 
    string|array $args = null)
                                            <p>Render a content with a specific tag mask</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_write">write</a>(
    string $content, 
    string $tag_type = &#039;default&#039;, 
    string|array $args = null)
                                            <p>Display on screen a content with a specific tag mask</p>                </div>
                <div class="col-md-2"></div>
            </div>
                    <div class="row">
                <div class="col-md-2 type">
                    
    string|<a href="../../Library/Reporter/Reporter.html"><abbr title="Library\Reporter\Reporter">Reporter</abbr></a>
                </div>
                <div class="col-md-8 type">
                    <a href="#method_renderMulti">renderMulti</a>(
    string $content, 
    string $tag_type = &#039;default&#039;, 
    array $multi = array(), 
    string|array $args = null, 
    string $placeholder_mask = &#039;@%s@&#039;)
                                            <p>Render a content with a specific tag mask and some placeholders</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 118</div>
        <code>                    
    
    <strong>__construct</strong>(
    null|string $adapter_type = &#039;html&#039;, 
    int $flag = self::OUTPUT_BY_LINE)</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Construction of a new Reporter object</p>                                </div>
                <div class="tags">
                            <h4>Parameters</h4>

                    <table class="table table-condensed">
                    <tr>
                <td>
    null|string</td>
                <td>$adapter_type</td>
                <td>The adapter type name</td>
            </tr>
                    <tr>
                <td>
    int</td>
                <td>$flag</td>
                <td>
</td>
            </tr>
            </table>

            
            
            
                    </div>
    </div>

            </div>
                    <div class="method-item">
                    <h3 id="method_reset">
        <div class="location">at line 130</div>
        <code>                    
    <a href="../../Library/Reporter/Reporter.html"><abbr title="Library\Reporter\Reporter">Reporter</abbr></a>
    <strong>reset</strong>(
    bool $hard = false)</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Reset all object properties to default or empty values</p>                                </div>
                <div class="tags">
                            <h4>Parameters</h4>

                    <table class="table table-condensed">
                    <tr>
                <td>
    bool</td>
                <td>$hard</td>
                <td>Reset all object properties (adapter included)</td>
            </tr>
            </table>

            
                            <h4>Return Value</h4>

                    <table class="table table-condensed">
        <tr>
            <td>
    <a href="../../Library/Reporter/Reporter.html"><abbr title="Library\Reporter\Reporter">Reporter</abbr></a></td>
            <td>$this for method chaining</td>
        </tr>
    </table>

            
            
                    </div>
    </div>

            </div>
                    <div class="method-item">
                    <h3 id="method___toString">
        <div class="location">at line 145</div>
        <code>                    
    string
    <strong>__toString</strong>()</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Returns the object global output</p>                                </div>
                <div class="tags">
            
                            <h4>Return Value</h4>

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

            
            
                    </div>
    </div>

            </div>
                    <div class="method-item">
                    <h3 id="method_setFlag">
        <div class="location">at line 160</div>
        <code>                    
    <a href="../../Library/Reporter/Reporter.html"><abbr title="Library\Reporter\Reporter">Reporter</abbr></a>
    <strong>setFlag</strong>(
    int $flag)</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Set the reporter flag</p>                                </div>
                <div class="tags">
                            <h4>Parameters</h4>

                    <table class="table table-condensed">
                    <tr>
                <td>
    int</td>
                <td>$flag</td>
                <td>The flag to set</td>
            </tr>
            </table>

            
                            <h4>Return Value</h4>

                    <table class="table table-condensed">
        <tr>
            <td>
    <a href="../../Library/Reporter/Reporter.html"><abbr title="Library\Reporter\Reporter">Reporter</abbr></a></td>
            <td>Returns <code>$this</code> for method chaining</td>
        </tr>
    </table>

            
            
                    </div>
    </div>

            </div>
                    <div class="method-item">
                    <h3 id="method_getFlag">
        <div class="location">at line 171</div>
        <code>                    
    int
    <strong>getFlag</strong>()</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Get the reporter flag</p>                                </div>
                <div class="tags">
            
                            <h4>Return Value</h4>

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

            
            
                    </div>
    </div>

            </div>
                    <div class="method-item">
                    <h3 id="method_setAdapterType">
        <div class="location">at line 183</div>
        <code>                    
    <a href="../../Library/Reporter/Reporter.html"><abbr title="Library\Reporter\Reporter">Reporter</abbr></a>
    <strong>setAdapterType</strong>(
    string $type)</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Set the adapter type to use</p>                                </div>
                <div class="tags">
                            <h4>Parameters</h4>

                    <table class="table table-condensed">
                    <tr>
                <td>
    string</td>
                <td>$type</td>
                <td>The type name</td>
            </tr>
            </table>

            
                            <h4>Return Value</h4>

                    <table class="table table-condensed">
        <tr>
            <td>
    <a href="../../Library/Reporter/Reporter.html"><abbr title="Library\Reporter\Reporter">Reporter</abbr></a></td>
            <td>$this for method chaining</td>
        </tr>
    </table>

            
                            <h4>Exceptions</h4>

                    <table class="table table-condensed">
                    <tr>
                <td><abbr title="Library\Reporter\Throws">Throws</abbr></td>
                <td>a RuntimeException if the adapter doesn't exist</td>
            </tr>
            </table>

            
                    </div>
    </div>

            </div>
                    <div class="method-item">
                    <h3 id="method_getAdapterType">
        <div class="location">at line 201</div>
        <code>                    
    object
    <strong>getAdapterType</strong>()</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Get the current adapter name</p>                                </div>
                <div class="tags">
            
                            <h4>Return Value</h4>

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

            
            
                    </div>
    </div>

            </div>
                    <div class="method-item">
                    <h3 id="method_setAdapter">
        <div class="location">at line 213</div>
        <code>                    
    <a href="../../Library/Reporter/Reporter.html"><abbr title="Library\Reporter\Reporter">Reporter</abbr></a>
    <strong>setAdapter</strong>(
    <abbr title="Library\Reporter\Library\Reporter\AbstractAdapter">AbstractAdapter</abbr> $adapter)</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Set the adapter</p>                                </div>
                <div class="tags">
                            <h4>Parameters</h4>

                    <table class="table table-condensed">
                    <tr>
                <td>
    <abbr title="Library\Reporter\Library\Reporter\AbstractAdapter">AbstractAdapter</abbr></td>
                <td>$adapter</td>
                <td>The instance of a ReporterAdapter</td>
            </tr>
            </table>

            
                            <h4>Return Value</h4>

                    <table class="table table-condensed">
        <tr>
            <td>
    <a href="../../Library/Reporter/Reporter.html"><abbr title="Library\Reporter\Reporter">Reporter</abbr></a></td>
            <td>
</td>
        </tr>
    </table>

            
                            <h4>Exceptions</h4>

                    <table class="table table-condensed">
                    <tr>
                <td><a target="_blank" href="http://php.net/LogicException"><abbr title="LogicException">LogicException</abbr></a></td>
                <td>
</td>
            </tr>
            </table>

            
                    </div>
    </div>

            </div>
                    <div class="method-item">
                    <h3 id="method_getAdapter">
        <div class="location">at line 232</div>
        <code>                    
    object
    <strong>getAdapter</strong>()</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Get the current adapter</p>                                </div>
                <div class="tags">
            
                            <h4>Return Value</h4>

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

            
            
                    </div>
    </div>

            </div>
                    <div class="method-item">
                    <h3 id="method_setOutput">
        <div class="location">at line 243</div>
        <code>                    
    <a href="../../Library/Reporter/Reporter.html"><abbr title="Library\Reporter\Reporter">Reporter</abbr></a>
    <strong>setOutput</strong>(
    string $output)</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Set some content</p>                                </div>
                <div class="tags">
                            <h4>Parameters</h4>

                    <table class="table table-condensed">
                    <tr>
                <td>
    string</td>
                <td>$output</td>
                <td>The content string</td>
            </tr>
            </table>

            
                            <h4>Return Value</h4>

                    <table class="table table-condensed">
        <tr>
            <td>
    <a href="../../Library/Reporter/Reporter.html"><abbr title="Library\Reporter\Reporter">Reporter</abbr></a></td>
            <td>Returns <code>$this</code> for method chaining</td>
        </tr>
    </table>

            
            
                    </div>
    </div>

            </div>
                    <div class="method-item">
                    <h3 id="method_getOutput">
        <div class="location">at line 258</div>
        <code>                    
    string
    <strong>getOutput</strong>()</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Get the processed content</p>                                </div>
                <div class="tags">
            
                            <h4>Return Value</h4>

                    <table class="table table-condensed">
        <tr>
            <td>
    string</td>
            <td>The content string</td>
        </tr>
    </table>

            
            
                    </div>
    </div>

            </div>
                    <div class="method-item">
                    <h3 id="method_render">
        <div class="location">at line 277</div>
        <code>                    
    string|<a href="../../Library/Reporter/Reporter.html"><abbr title="Library\Reporter\Reporter">Reporter</abbr></a>
    <strong>render</strong>(
    string $content, 
    string $tag_type = &#039;default&#039;, 
    string|array $args = null)</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Render a content with a specific tag mask</p>                                </div>
                <div class="tags">
                            <h4>Parameters</h4>

                    <table class="table table-condensed">
                    <tr>
                <td>
    string</td>
                <td>$content</td>
                <td>The content string to use</td>
            </tr>
                    <tr>
                <td>
    string</td>
                <td>$tag_type</td>
                <td>The type of tag mask to use</td>
            </tr>
                    <tr>
                <td>
    string|array</td>
                <td>$args</td>
                <td>An array of arguments to pass to the mask (or a single string that
                         will be taken as the first array item)</td>
            </tr>
            </table>

            
                            <h4>Return Value</h4>

                    <table class="table table-condensed">
        <tr>
            <td>
    string|<a href="../../Library/Reporter/Reporter.html"><abbr title="Library\Reporter\Reporter">Reporter</abbr></a></td>
            <td>Returns the line of output if the object flag is set on <code>OUTPUT_BY_LINE</code>,
                     or <code>$this</code> if the flag is set on <code>OUTPUT_APPEND</code></td>
        </tr>
    </table>

            
            
                    </div>
    </div>

            </div>
                    <div class="method-item">
                    <h3 id="method_write">
        <div class="location">at line 299</div>
        <code>                    
    void
    <strong>write</strong>(
    string $content, 
    string $tag_type = &#039;default&#039;, 
    string|array $args = null)</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Display on screen a content with a specific tag mask</p>                                </div>
                <div class="tags">
                            <h4>Parameters</h4>

                    <table class="table table-condensed">
                    <tr>
                <td>
    string</td>
                <td>$content</td>
                <td>The content string to use</td>
            </tr>
                    <tr>
                <td>
    string</td>
                <td>$tag_type</td>
                <td>The type of tag mask to use</td>
            </tr>
                    <tr>
                <td>
    string|array</td>
                <td>$args</td>
                <td>An array of arguments to pass to the mask (or a single string that
                         will be taken as the first array item)</td>
            </tr>
            </table>

            
                            <h4>Return Value</h4>

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

            
            
                    </div>
    </div>

            </div>
                    <div class="method-item">
                    <h3 id="method_renderMulti">
        <div class="location">at line 333</div>
        <code>                    
    string|<a href="../../Library/Reporter/Reporter.html"><abbr title="Library\Reporter\Reporter">Reporter</abbr></a>
    <strong>renderMulti</strong>(
    string $content, 
    string $tag_type = &#039;default&#039;, 
    array $multi = array(), 
    string|array $args = null, 
    string $placeholder_mask = &#039;@%s@&#039;)</code>
    </h3>
    <div class="details">
                    <div class="method-description">
                                    <p>Render a content with a specific tag mask and some placeholders</p>                    <p>This is quite the same as the <code>render()</code> method but in this case, the <code>$content</code> string
may contains some placeholders like <code>@name@</code> that will be replaced in the result by
the <code>name</code> item of the <code>$multi</code> array argument after rendering it by the <code>render()</code> method.</p>

<p>For instance:</p>

<pre><code>$str = $obj-&gt;renderMulti( 'my string with @name@ placeholder', 'default', array(
    'name' =&gt; array( 'a specific string as' , 'strong' )
));
</code></pre>

<p>will return:</p>

<pre><code>"&lt;p&gt;my string with &lt;strong&gt;a specific string as&lt;/strong&gt; placeholder&lt;/p&gt;"
</code></pre>
</p>            </div>
                <div class="tags">
                            <h4>Parameters</h4>

                    <table class="table table-condensed">
                    <tr>
                <td>
    string</td>
                <td>$content</td>
                <td>The content string to use</td>
            </tr>
                    <tr>
                <td>
    string</td>
                <td>$tag_type</td>
                <td>The type of tag mask to use</td>
            </tr>
                    <tr>
                <td>
    array</td>
                <td>$multi</td>
                <td>The array of imbricated elements for content replacements</td>
            </tr>
                    <tr>
                <td>
    string|array</td>
                <td>$args</td>
                <td>An array of arguments to pass to the mask (or a single string that
                         will be taken as the first array item)</td>
            </tr>
                    <tr>
                <td>
    string</td>
                <td>$placeholder_mask</td>
                <td>The mask used to build placeholders names in <code>$content</code></td>
            </tr>
            </table>

            
                            <h4>Return Value</h4>

                    <table class="table table-condensed">
        <tr>
            <td>
    string|<a href="../../Library/Reporter/Reporter.html"><abbr title="Library\Reporter\Reporter">Reporter</abbr></a></td>
            <td>Returns the line of output if the object flag is set on <code>OUTPUT_BY_LINE</code>,
                     or <code>$this</code> if the flag is set on <code>OUTPUT_APPEND</code></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>