<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.yaf-route-map.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'yaf-route-map.route.php',
    1 => 'Yaf_Route_Map::route',
    2 => 'Route a request',
  ),
  'up' => 
  array (
    0 => 'class.yaf-route-map.php',
    1 => 'Yaf_Route_Map',
  ),
  'prev' => 
  array (
    0 => 'yaf-route-map.construct.php',
    1 => 'Yaf_Route_Map::__construct',
  ),
  'next' => 
  array (
    0 => 'class.yaf-route-regex.php',
    1 => 'Yaf_Route_Regex',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/yaf/yaf_route_map/route.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="yaf-route-map.route" class="refentry">
 <div class="refnamediv">
<h1 class="refname">Yaf_Route_Map::route</h1>
<p class="verinfo">(Yaf &gt;=1.0.0)</p><p class="refpurpose"><span class="refname">Yaf_Route_Map::route</span> &mdash; <span class="dc-title">Route a request</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-yaf-route-map.route-description">
  <h3 class="title">Опис</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">function</span> <span class="methodname"><strong>Yaf_Route_Map::route</strong></span>(<span class="methodparam"><span class="type"><a href="class.yaf-request-abstract.php" class="type Yaf_Request_Abstract">Yaf_Request_Abstract</a></span> <code class="parameter">$request</code></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="simpara">Route the request by mapping the whole URI to a controller name or an action name: the path segments of the URI are joined with underscores to form the name.</p>
  <p class="simpara">When the route was constructed with the controller prefer flag on, the result is set as the controller name, otherwise as the action name.</p>
 </div>


 <div class="refsect1 parameters" id="refsect1-yaf-route-map.route-parameters">
  <h3 class="title">Параметри</h3>
  <dl>
   
    <dt><code class="parameter">request</code></dt>
    <dd>
<p class="simpara">The <span class="classname"><a href="class.yaf-request-abstract.php" class="classname">Yaf_Request_Abstract</a></span> instance to route.</p>
    </dd>
   
  </dl>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-yaf-route-map.route-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
<p class="simpara">Always returns <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>. Note that the map route claims the request even when the URI is empty, in which case no name is set.</p>
 </div>


 <div class="refsect1 examples" id="refsect1-yaf-route-map.route-examples">
  <h3 class="title">Приклади</h3>
  <div class="example" id="example-1">
   <p><strong>Приклад #1 <span class="methodname"><strong>Yaf_Route_Map::route()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php
$request </span><span style="color: #007700">= new </span><span style="color: #0000BB">Yaf_Request_Simple</span><span style="color: #007700">(</span><span style="color: #DD0000">"CLI"</span><span style="color: #007700">);
</span><span style="color: #0000BB">$request</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setRequestUri</span><span style="color: #007700">(</span><span style="color: #DD0000">"/product/foo/bar"</span><span style="color: #007700">);

</span><span style="color: #0000BB">$route </span><span style="color: #007700">= new </span><span style="color: #0000BB">Yaf_Route_Map</span><span style="color: #007700">();
</span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$route</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">route</span><span style="color: #007700">(</span><span style="color: #0000BB">$request</span><span style="color: #007700">));
</span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$request</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getActionName</span><span style="color: #007700">());
</span><span style="color: #0000BB">?&gt;</span></code></pre></div>
   </div>

   <div class="example-contents"><p>Поданий вище приклад виведе щось
схоже на:</p></div>
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">bool(true)
string(15) &quot;product_foo_bar&quot;</pre>
</div>
   </div>
  </div>
  <div class="example" id="example-2">
   <p><strong>Приклад #2 <span class="methodname"><strong>Yaf_Route_Map::route()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php
$request </span><span style="color: #007700">= new </span><span style="color: #0000BB">Yaf_Request_Simple</span><span style="color: #007700">(</span><span style="color: #DD0000">"CLI"</span><span style="color: #007700">);
</span><span style="color: #0000BB">$request</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setRequestUri</span><span style="color: #007700">(</span><span style="color: #DD0000">"/user/list/_/foo/22"</span><span style="color: #007700">);

</span><span style="color: #0000BB">$route </span><span style="color: #007700">= new </span><span style="color: #0000BB">Yaf_Route_Map</span><span style="color: #007700">(</span><span style="color: #0000BB">true</span><span style="color: #007700">, </span><span style="color: #DD0000">"_"</span><span style="color: #007700">);
</span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$route</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">route</span><span style="color: #007700">(</span><span style="color: #0000BB">$request</span><span style="color: #007700">));
</span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$request</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getControllerName</span><span style="color: #007700">());
</span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$request</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getParam</span><span style="color: #007700">(</span><span style="color: #DD0000">"foo"</span><span style="color: #007700">));
</span><span style="color: #0000BB">?&gt;</span></code></pre></div>
   </div>

   <div class="example-contents"><p>Поданий вище приклад виведе щось
схоже на:</p></div>
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">bool(true)
string(9) &quot;User_List&quot;
string(2) &quot;22&quot;</pre>
</div>
   </div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-yaf-route-map.route-seealso">
  <h3 class="title">Прогляньте також</h3>
  <ul class="simplelist">
   <li><span class="methodname"><a href="yaf-route-map.construct.php" class="methodname" rel="rdfs-seeAlso">Yaf_Route_Map::__construct()</a> - Construct a map route</span></li>
   <li><span class="methodname"><a href="yaf-route-map.assemble.php" class="methodname" rel="rdfs-seeAlso">Yaf_Route_Map::assemble()</a> - Assemble a url</span></li>
  </ul>
 </div>

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