<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.yar-server.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'yar-server.handle.php',
    1 => 'Yar_Server::handle',
    2 => 'Start the RPC server',
  ),
  'up' => 
  array (
    0 => 'class.yar-server.php',
    1 => 'Yar_Server',
  ),
  'prev' => 
  array (
    0 => 'yar-server.construct.php',
    1 => 'Yar_Server::__construct',
  ),
  'next' => 
  array (
    0 => 'class.yar-client.php',
    1 => 'Yar_Client',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/yar/yar_server/handle.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="yar-server.handle" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Yar_Server::handle</h1>
  <p class="verinfo">(PECL yar &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">Yar_Server::handle</span> &mdash; <span class="dc-title">Start the RPC server</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-yar-server.handle-description">
  <h3 class="title">Опис</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">function</span> <span class="methodname"><strong>Yar_Server::handle</strong></span>(): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="simpara">
   Starts handling the incoming RPC request.
  </p>
  <blockquote class="note"><p><strong class="note">Зауваження</strong>: 
   <p class="simpara">
    Usual RPC calls are issued as HTTP POST requests. If an HTTP GET
    request is issued instead, the service information page, generated
    from the public methods and their doc comments of the executor
    object, is printed. This behaviour can be disabled with the
    <a href="yar.configuration.php#ini.yar.expose-info" class="link">yar.expose_info</a>
    directive, in which case a GET request throws a
    <span class="exceptionname"><a href="class.yar-server-exception.php" class="exceptionname">Yar_Server_Exception</a></span>.
   </p>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">Зауваження</strong>: 
   <p class="simpara">
    As of Yar 2.3.0, the executor object may define the protected
    magic methods <code class="literal">__info</code> and
    <code class="literal">__auth</code> to customize the service information
    page and to authenticate requests; see
    <span class="methodname"><a href="yar-server.construct.php" class="methodname">Yar_Server::__construct()</a></span> for details.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 parameters" id="refsect1-yar-server.handle-parameters">
  <h3 class="title">Параметри</h3>
  <p class="para">У цієї функції немає
параметрів.</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-yar-server.handle-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
  <p class="simpara">
   Returns <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-yar-server.handle-errors">
  <h3 class="title">Помилки/виключення</h3>
  <p class="para">
   <table class="doctable table">
    <caption><strong><span class="methodname"><strong>Yar_Server::handle()</strong></span> errors</strong></caption>
    
     <thead>
      <tr>
       <th>Condition</th>
       <th>Exception</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>
        The remote method threw an exception.
       </td>
       <td>
        <span class="exceptionname"><a href="class.yar-server-exception.php" class="exceptionname">Yar_Server_Exception</a></span> (with the
        original class name in its <code class="literal">_type</code> property).
       </td>
      </tr>

      <tr>
       <td>
        The remote method was not found or is not public.
       </td>
       <td>
        <span class="exceptionname"><a href="class.yar-server-request-exception.php" class="exceptionname">Yar_Server_Request_Exception</a></span>.
       </td>
      </tr>

      <tr>
       <td>
        The request body could not be unpacked.
       </td>
       <td>
        <span class="exceptionname"><a href="class.yar-server-packager-exception.php" class="exceptionname">Yar_Server_Packager_Exception</a></span>.
       </td>
      </tr>

      <tr>
       <td>
        The request is malformed on the protocol level.
       </td>
       <td>
        <span class="exceptionname"><a href="class.yar-server-protocol-exception.php" class="exceptionname">Yar_Server_Protocol_Exception</a></span>.
       </td>
      </tr>

      <tr>
       <td>
        The server output could not be captured.
       </td>
       <td>
        <span class="exceptionname"><a href="class.yar-server-output-exception.php" class="exceptionname">Yar_Server_Output_Exception</a></span>.
       </td>
      </tr>

      <tr>
       <td>
        Authentication failed, or the info page was requested while
        <a href="yar.configuration.php#ini.yar.expose-info" class="link">yar.expose_info</a> is
        off.
       </td>
       <td>
        <span class="exceptionname"><a href="class.yar-server-exception.php" class="exceptionname">Yar_Server_Exception</a></span> with code
        <strong><code><a href="yar.constants.php#constant.yar-err-forbidden">YAR_ERR_FORBIDDEN</a></code></strong>.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-yar-server.handle-examples">
  <h3 class="title">Приклади</h3>
  <div class="example" id="example-1">
   <p><strong>Приклад #1 <span class="methodname"><strong>Yar_Server::handle()</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">API </span><span style="color: #007700">{
    </span><span style="color: #FF8000">/**
     * The doc block is shown on the service info page.
     * @param string $parameter
     * @return string
     */
    </span><span style="color: #007700">public function </span><span style="color: #0000BB">some_method</span><span style="color: #007700">(</span><span style="color: #0000BB">$parameter</span><span style="color: #007700">, </span><span style="color: #0000BB">$option </span><span style="color: #007700">= </span><span style="color: #DD0000">"foo"</span><span style="color: #007700">) {
        return </span><span style="color: #DD0000">"some_method"</span><span style="color: #007700">;
    }

    protected function </span><span style="color: #0000BB">client_can_not_see</span><span style="color: #007700">() {
    }
}

</span><span style="color: #0000BB">$service </span><span style="color: #007700">= new </span><span style="color: #0000BB">Yar_Server</span><span style="color: #007700">(new </span><span style="color: #0000BB">API</span><span style="color: #007700">());
</span><span style="color: #0000BB">$service</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">handle</span><span style="color: #007700">();
</span><span style="color: #0000BB">?&gt;</span></code></pre></div>
   </div>

  </div>
  <div class="example" id="example-2">
   <p><strong>Приклад #2 Customizing the service information page with
   <code class="literal">__info</code> (as of Yar 2.3.0)</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">API </span><span style="color: #007700">{
    public function </span><span style="color: #0000BB">some_method</span><span style="color: #007700">(</span><span style="color: #0000BB">$parameter</span><span style="color: #007700">, </span><span style="color: #0000BB">$option </span><span style="color: #007700">= </span><span style="color: #DD0000">"foo"</span><span style="color: #007700">) {
        return </span><span style="color: #DD0000">"some_method"</span><span style="color: #007700">;
    }

    </span><span style="color: #FF8000">/*
     * Must be protected. It is called on GET requests with the markup of
     * the page Yar would otherwise render, and its string return value is
     * sent to the client instead.
     */
    </span><span style="color: #007700">protected function </span><span style="color: #0000BB">__info</span><span style="color: #007700">(</span><span style="color: #0000BB">$markup</span><span style="color: #007700">) {
        return </span><span style="color: #DD0000">"Hello world"</span><span style="color: #007700">;
    }
}

</span><span style="color: #0000BB">$service </span><span style="color: #007700">= new </span><span style="color: #0000BB">Yar_Server</span><span style="color: #007700">(new </span><span style="color: #0000BB">API</span><span style="color: #007700">());
</span><span style="color: #0000BB">$service</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">handle</span><span style="color: #007700">();
</span><span style="color: #0000BB">?&gt;</span></code></pre></div>
   </div>

  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-yar-server.handle-seealso">
  <h3 class="title">Прогляньте також</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="methodname"><a href="yar-server.construct.php" class="methodname" rel="rdfs-seeAlso">Yar_Server::__construct()</a> - Create an RPC server</span></li>
   </ul>
  </p>
 </div>


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