<?xml version="1.0" encoding="UTF-8"?>
<!-- EN-Revision: 24249 -->
<!-- Reviewed: no -->
<sect2 id="zend.application.core-functionality.application">
    <title>Zend_Application</title>

    <para>
        <classname>Zend_Application</classname> fornece a base da funcionalidade do componente, é o
        ponto de entrada para sua aplicação Zend Framework. Seu propósito duplo: definir o ambiente
        <acronym>PHP</acronym> (incluindo autocarregamento) e para executar a inicialização da
        aplicação.
    </para>

    <para>
        Tipicamenteo, você passará todas as configurações ao construtor de
        <classname>Zend_Application</classname>, mas você também pode configurar inteiramente o
        objeto usando seus próprios métodos. Esta referência é voltada a ilustrar ambos os casos.
    </para>

    <table id="zend.application.core-functionality.application.api.options">
        <title>Opções de Zend_Application</title>

        <tgroup cols="2">
            <thead>
                <row>
                    <entry>Opção</entry>
                    <entry>Descrição</entry>
                </row>
            </thead>

            <tbody>
                <row>
                    <entry><emphasis><property>phpSettings</property></emphasis></entry>

                    <entry>
                        <para>
                            Matriz de opções <filename>php.ini</filename> para utilizar. Chaves
                            devem devem ser as mesmas do <filename>php.ini</filename>.
                        </para>
                    </entry>
                </row>

                <row>
                    <entry><emphasis><property>includePaths</property></emphasis></entry>

                    <entry>
                        <para>
                            Caminhos adicionais para acrescentar ao
                            <emphasis>include_path</emphasis>. Deve ser uma matriz de caminhos.
                        </para>
                    </entry>
                </row>

                <row>
                    <entry><emphasis><property>autoloaderNamespaces</property></emphasis></entry>

                    <entry>
                        <para>
                            Matriz de espaços de nomes adicionais para registrar com a instância de
                            <classname>Zend_Loader_Autoloader</classname>.
                        </para>
                    </entry>
                </row>

                <row>
                    <entry><emphasis><property>bootstrap</property></emphasis></entry>

                    <entry>
                        <para>
                            Pode ser tanto uma sequência de caracteres (string) para o caminho da
                            classe de inicialização, ou uma matriz com elementos 'path' e 'class'
                            (caminho e classe, respectivamente) para a inicialização da aplicação.
                        </para>
                    </entry>
                </row>
            </tbody>
        </tgroup>
    </table>

    <note>
        <title>Nomes das opções</title>

        <para>
            Tenha em mente que os nomes das opções são insensíveis ao caso.
        </para>
    </note>

    <table id="zend.application.core-functionality.application.api.table">
        <title>Métodos Zend_Application</title>

        <tgroup cols="4">
            <thead>
                <row>
                    <entry>Método</entry>
                    <entry>Valor de Retorno</entry>
                    <entry>Parameteros</entry>
                    <entry>Descrição</entry>
                </row>
            </thead>

            <tbody>
                <row>
                    <entry>
                        <methodname>__construct($environment, $options = null)</methodname>
                    </entry>

                    <entry><type>Void</type></entry>

                    <entry>
                        <itemizedlist>
                            <listitem>
                                <para>
                                    <varname>$environment</varname>:
                                    <emphasis>obrigatória</emphasis>,.
                                    Sequência de caracteres representando o ambiente da aplicação
                                    atual. Sequências típicas podem incluir "development",
                                    "testing", "qa" ou "production" mas serão definidas por seus
                                    requisitos organizacionais.
                                </para>
                            </listitem>

                            <listitem>
                                <para>
                                    <varname>$options</varname>: <emphasis>opcional</emphasis>.
                                    O argumento pode ser um dos seguintes valores:
                                </para>

                                <itemizedlist>
                                    <listitem>
                                        <para>
                                            <emphasis><type>String</type></emphasis>: caminho para
                                            um arquivo <classname>Zend_Config</classname> a ser
                                            carregado como configuração de sua aplicação.
                                            <varname>$environment</varname> será utilizada para
                                            determinar qual seção da configuração carregar.
                                        </para>

                                        <para>
                                            As of 1.10, you may also pass multiple paths containing
                                            config files to be merged into a single configuration.
                                            This assists in reducing config duplication across many
                                            contexts which share common settings (e.g. configs for
                                            <acronym>HTTP</acronym>, or <acronym>CLI</acronym>, each
                                            sharing some characteristics but with their own
                                            conflicting values for others) or merely splitting a
                                            long configuration across many smaller categorised
                                            files. The parameter in this case is an array with a
                                            single key "config" whose value is an array of the
                                            files to merge. Note: this means you either pass a
                                            literal path, or
                                            <command>
                                                array("config"=>array("/path1","/path2"[,...]));
                                            </command>.
                                        </para>
                                    </listitem>

                                    <listitem>
                                        <para>
                                            <emphasis><type>Array</type></emphasis>: associative
                                            array of configuration data for your application.
                                        </para>
                                    </listitem>

                                    <listitem>
                                        <para>
                                            <emphasis><classname>Zend_Config</classname></emphasis>:
                                            configuration object instance.
                                        </para>
                                    </listitem>
                                </itemizedlist>
                            </listitem>
                        </itemizedlist>
                    </entry>

                    <entry>
                        <para>
                            Constructor. Arguments are as described, and will be
                            used to set initial object state. An instance of
                            <classname>Zend_Loader_Autoloader</classname> is registered
                            during instantiation. Options passed to the
                            constructor are passed to <methodname>setOptions()</methodname>.
                        </para>
                    </entry>
                </row>

                <row>
                    <entry><methodname>getEnvironment()</methodname></entry>
                    <entry><type>String</type></entry>
                    <entry>N/A</entry>

                    <entry>
                        <para>Retrieve the environment string passed to the constructor.</para>
                    </entry>
                </row>

                <row>
                    <entry><methodname>getAutoloader()</methodname></entry>
                    <entry><classname>Zend_Loader_Autoloader</classname></entry>
                    <entry>N/A</entry>

                    <entry>
                        <para>
                            Retrieve the <classname>Zend_Loader_Autoloader</classname>
                            instance registered during instantiation.
                        </para>
                    </entry>
                </row>

                <row>
                    <entry><methodname>setOptions(array $options)</methodname></entry>
                    <entry><classname>Zend_Application</classname></entry>

                    <entry>
                        <itemizedlist>
                            <listitem>
                                <para>
                                    <varname>$options</varname>: <emphasis>required</emphasis>.
                                    An array of application options.
                                </para>
                            </listitem>
                        </itemizedlist>
                    </entry>

                    <entry>
                        <para>
                            All options are stored internally, and calling the
                            method multiple times will merge options. Options
                            matching the various setter methods will be passed
                            to those methods. As an example, the option
                            "phpSettings" will then be passed to
                            <methodname>setPhpSettings()</methodname>. (Option names are
                            case insensitive.)
                        </para>
                    </entry>
                </row>

                <row>
                    <entry><methodname>getOptions()</methodname></entry>
                    <entry><type>Array</type></entry>
                    <entry>N/A</entry>

                    <entry>
                        <para>
                            Retrieve all options used to initialize the object;
                            could be used to cache <classname>Zend_Config</classname>
                            options to a serialized format between requests.
                        </para>
                    </entry>
                </row>

                <row>
                    <entry><methodname>hasOption($key)</methodname></entry>
                    <entry><type>Boolean</type></entry>
                    <entry>
                        <itemizedlist>
                            <listitem>
                                <para>
                                    <varname>$key</varname>: String option key to lookup
                                </para>
                            </listitem>
                        </itemizedlist>
                    </entry>

                    <entry>
                        <para>
                            Determine whether or not an option with the
                            specified key has been registered. Keys are case insensitive.
                        </para>
                    </entry>
                </row>

                <row>
                    <entry><methodname>getOption($key)</methodname></entry>
                    <entry><type>Mixed</type></entry>
                    <entry>
                        <itemizedlist>
                            <listitem>
                                <para><varname>$key</varname>: String option key to lookup</para>
                            </listitem>
                        </itemizedlist>
                    </entry>

                    <entry>
                        <para>
                            Retrieve the option value of a given key. Returns
                            <constant>NULL</constant> if the key does not exist.
                        </para>
                    </entry>
                </row>

                <row>
                    <entry>
                        <methodname>setPhpSettings(array $settings, $prefix = '')</methodname>
                    </entry>

                    <entry><classname>Zend_Application</classname></entry>

                    <entry>
                        <itemizedlist>
                            <listitem>
                                <para>
                                    <varname>$settings</varname>: <emphasis>required</emphasis>.
                                    Associative array of <acronym>PHP</acronym>
                                    <acronym>INI</acronym> settings.
                                </para>
                            </listitem>

                            <listitem>
                                <para>
                                    <varname>$prefix</varname>: <emphasis>optional</emphasis>.
                                    String prefix with which to prepend option keys. Used
                                    internally to allow mapping nested arrays to dot-separated
                                    <filename>php.ini</filename> keys. In normal usage, this
                                    argument should never be passed by a user.
                                </para>
                            </listitem>
                        </itemizedlist>
                    </entry>

                    <entry>
                        <para>
                            Set run-time <filename>php.ini</filename> settings. Dot-separated
                            settings may be nested hierarchically (which may occur
                            with <acronym>INI</acronym> <classname>Zend_Config</classname> files)
                            via an array-of-arrays, and will still resolve correctly.
                        </para>
                    </entry>
                </row>

                <row>
                    <entry>
                        <methodname>setAutoloaderNamespaces(array $namespaces)</methodname>
                    </entry>

                    <entry><classname>Zend_Application</classname></entry>

                    <entry>
                        <itemizedlist>
                            <listitem>
                                <para>
                                    <varname>$namespaces</varname>: <emphasis>required</emphasis>.
                                    Array of strings representing the namespaces to
                                    register with the <classname>Zend_Loader_Autoloader</classname>
                                    instance.
                                </para>
                            </listitem>
                        </itemizedlist>
                    </entry>

                    <entry>
                        <para>
                            Register namespaces with the
                            <classname>Zend_Loader_Autoloader</classname> instance.
                        </para>
                    </entry>
                </row>

                <row>
                    <entry><methodname>setBootstrap($path, $class = null)</methodname></entry>
                    <entry><classname>Zend_Application</classname></entry>

                    <entry>
                        <itemizedlist>
                            <listitem>
                                <para>
                                    <varname>$path</varname>: <emphasis>required</emphasis>. May be
                                    either a
                                    <classname>Zend_Application_Bootstrap_Bootstrapper</classname>
                                    instance, a string path to the bootstrap class, an
                                    associative array of classname =&gt; filename, or an associative
                                    array with the keys 'class' and 'path'.
                                </para>
                            </listitem>

                            <listitem>
                                <para>
                                    <varname>$class</varname>: <emphasis>optional</emphasis>.
                                    If <varname>$path</varname> is a string,
                                    <varname>$class</varname> may be specified, and should
                                    be a string class name of the class contained in
                                    the file represented by path.
                                </para>
                            </listitem>
                        </itemizedlist>
                    </entry>
                </row>

                <row>
                    <entry><methodname>getBootstrap()</methodname></entry>

                    <entry>
                        <constant>NULL</constant> |
                        <classname>Zend_Application_Bootstrap_Bootstrapper</classname>
                    </entry>

                    <entry>N/A</entry>
                    <entry><para>Retrieve the registered bootstrap instance.</para></entry>
                </row>

                <row>
                    <entry><methodname>bootstrap()</methodname></entry>
                    <entry><type>Void</type></entry>
                    <entry>N/A</entry>
                    <entry>
                        <para>
                            Call the bootstrap's <methodname>bootstrap()</methodname>
                            method to bootstrap the application.
                        </para>
                    </entry>
                </row>

                <row>
                    <entry><methodname>run()</methodname></entry>
                    <entry><type>Void</type></entry>
                    <entry>N/A</entry>
                    <entry>
                        <para>
                            Call the bootstrap's <methodname>run()</methodname>
                            method to dispatch the application.
                        </para>
                    </entry>
                </row>
            </tbody>
        </tgroup>
    </table>
</sect2>
