<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.yaf-request-abstract.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'yaf-request-abstract.setmodulename.php',
    1 => 'Yaf_Request_Abstract::setModuleName',
    2 => 'Set module name',
  ),
  'up' => 
  array (
    0 => 'class.yaf-request-abstract.php',
    1 => 'Yaf_Request_Abstract',
  ),
  'prev' => 
  array (
    0 => 'yaf-request-abstract.setdispatched.php',
    1 => 'Yaf_Request_Abstract::setDispatched',
  ),
  'next' => 
  array (
    0 => 'yaf-request-abstract.setparam.php',
    1 => 'Yaf_Request_Abstract::setParam',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/yaf/yaf_request_abstract/setmodulename.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="yaf-request-abstract.setmodulename" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Yaf_Request_Abstract::setModuleName</h1>
  <p class="verinfo">(Yaf &gt;=1.0.0)</p><p class="refpurpose"><span class="refname">Yaf_Request_Abstract::setModuleName</span> &mdash; <span class="dc-title">Set module name</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-yaf-request-abstract.setmodulename-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">function</span> <span class="methodname"><strong>Yaf_Request_Abstract::setModuleName</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$module</code></span>, <span class="methodparam"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$format_name</code><span class="initializer"> = true</span></span>): <span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="class.yaf-request-abstract.php" class="type Yaf_Request_Abstract">Yaf_Request_Abstract</a></span></span></div>

  <p class="para rdfs-comment">
    set module name to request, this is usually used by custom router to set route result module name.
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-yaf-request-abstract.setmodulename-parameters">
  <h3 class="title">Parameters</h3>
  <dl>
   
    <dt><code class="parameter">module</code></dt>
    <dd>
     <p class="para">
      <span class="type"><a href="language.types.string.php" class="type string">string</a></span> module name, it should be in camel style, like &quot;Index&quot; or &quot;Foo_Bar&quot;   
     </p>
    </dd>
   
   
    <dt><code class="parameter">format_name</code></dt>
    <dd>
     <p class="para">
      this is introduced in Yaf 3.2.0, by default Yaf will format the name into camel mode,
      if this is set to <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> , Yaf will set the original name to request.
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-yaf-request-abstract.setmodulename-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="simpara">
   Returns the request object itself on success, or <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> on failure.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-yaf-request-abstract.setmodulename-examples">
  <h3 class="title">Examples</h3>
  <div class="example" id="example-1">
   <p><strong>Example #1 <span class="methodname"><strong>Yaf_Request_Abstract::setModuleName()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php
</span><span style="color: #007700">class </span><span style="color: #0000BB">AdminRouter </span><span style="color: #007700">extends </span><span style="color: #0000BB">Yaf_Route_Interface
</span><span style="color: #007700">{
    public function </span><span style="color: #0000BB">route</span><span style="color: #007700">(</span><span style="color: #0000BB">Yaf_Request_Abstract $request</span><span style="color: #007700">)
    {
        </span><span style="color: #FF8000">// Serve everything under /admin from the Admin module
        </span><span style="color: #007700">if (</span><span style="color: #0000BB">0 </span><span style="color: #007700">=== </span><span style="color: #0000BB">strpos</span><span style="color: #007700">(</span><span style="color: #0000BB">$request</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getRequestUri</span><span style="color: #007700">(), </span><span style="color: #DD0000">"/admin"</span><span style="color: #007700">)) {
            </span><span style="color: #0000BB">$request</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setModuleName</span><span style="color: #007700">(</span><span style="color: #DD0000">"Admin"</span><span style="color: #007700">)
                    -&gt;</span><span style="color: #0000BB">setControllerName</span><span style="color: #007700">(</span><span style="color: #DD0000">"Dashboard"</span><span style="color: #007700">)
                    -&gt;</span><span style="color: #0000BB">setActionName</span><span style="color: #007700">(</span><span style="color: #DD0000">"index"</span><span style="color: #007700">);
            return </span><span style="color: #0000BB">true</span><span style="color: #007700">;
        }

        return </span><span style="color: #0000BB">false</span><span style="color: #007700">;
    }

    public function </span><span style="color: #0000BB">assemble</span><span style="color: #007700">(array </span><span style="color: #0000BB">$info</span><span style="color: #007700">, array </span><span style="color: #0000BB">$query </span><span style="color: #007700">= </span><span style="color: #0000BB">null</span><span style="color: #007700">) {}
}
</span><span style="color: #0000BB">?&gt;</span></code></pre></div>
   </div>

  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-yaf-request-abstract.setmodulename-seealso">
  <h3 class="title">See Also</h3>
  <ul class="simplelist">
   <li><span class="methodname"><a href="yaf-request-abstract.setcontrollername.php" class="methodname" rel="rdfs-seeAlso">Yaf_Request_Abstract::setControllerName()</a> - Set controller name</span></li>
   <li><span class="methodname"><a href="yaf-request-abstract.setactionname.php" class="methodname" rel="rdfs-seeAlso">Yaf_Request_Abstract::setActionName()</a> - Set action name</span></li>
   <li><span class="methodname"><a href="yaf-request-abstract.getmodulename.php" class="methodname" rel="rdfs-seeAlso">Yaf_Request_Abstract::getModuleName()</a> - Retrieve the module name</span></li>
  </ul>
 </div>

</div><?php manual_footer($setup); ?>