Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0386928

Browse filesBrowse files
pt_BR translate
1 parent edddf98 commit 0386928
Copy full SHA for 0386928

File tree

Expand file treeCollapse file tree

1 file changed

+30
-29
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+30
-29
lines changed

‎pt_BR/guides/tools/autoloader.rst

Copy file name to clipboardExpand all lines: pt_BR/guides/tools/autoloader.rst
+30-29Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@
44
Autoloader
55
==========
66

7-
Whenever you use an undefined class, PHP uses the autoloading mechanism to
8-
delegate the loading of a file defining the class. Symfony2 provides a
9-
"universal" autoloader, which is able to load classes from files that
10-
implement one of the following conventions:
7+
Sempre que você usa uma classe indefinida, o PHP usa o mecanismo de autoloading para
8+
delegar o carregamento de um arquivo que defina a classe. O Symfony2 fornece um
9+
autoloader "universal", que é capaz de carregar as classes de arquivos que implementem
10+
uma das seguintes convenções:
1111

12-
* The technical interoperability `standards`_ for PHP 5.3 namespaces and class
12+
* As `normas`_ técnicas de interoperabilidade para os namespaces e classes do PHP 5.3
1313
names;
1414

15-
* The `PEAR`_ naming convention for classes.
15+
* A nomeação conforme a convenção do `PEAR`_ para classes.
1616

17-
If your classes and the third-party libraries you use for your project follow
18-
these standards, the Symfony2 autoloader is the only autoloader you will ever
19-
need.
17+
Se suas classes e as bibliotecas de terceiros que você usa no seu projeto seguem
18+
essas normas, o autoloader do Symfony2 será o único autoloader que você irá
19+
precisar
2020

21-
Usage
22-
-----
21+
Uso
22+
---
2323

24-
Registering the autoloader is straightforward::
24+
Registrar o autoloader é simples::
2525

2626
require_once '/path/to/src/Symfony/Foundation/UniversalClassLoader.php';
2727

@@ -30,14 +30,15 @@ Registering the autoloader is straightforward::
3030
$loader = new UniversalClassLoader();
3131
$loader->register();
3232

33-
The autoloader is useful only if you add some libraries to autoload.
33+
O autoloader é útil apenas se você que adicionar algumas bibliotecas para carregarem
34+
automaticamente.
3435

3536
.. note::
36-
The autoloader is automatically registered in a Symfony2 application (see
37+
O autoloader é automaticamente registrado em uma aplicação do Symfony2 (veja
3738
``src/autoload.php``).
3839

39-
If the classes to autoload use namespaces, use the ``registerNamespace()`` or
40-
``registerNamespaces()`` methods::
40+
Se as classes a serem carregadas automaticamente usam namespaces, use o método
41+
``registerNamespace()`` ou ``registerNamespaces()`` ::
4142

4243
$loader->registerNamespace('Symfony', __DIR__.'/vendor/symfony/src');
4344

@@ -46,8 +47,8 @@ If the classes to autoload use namespaces, use the ``registerNamespace()`` or
4647
'Zend' => __DIR__.'/vendor/zend/library',
4748
));
4849

49-
For classes that follow the PEAR naming convention, use the ``registerPrefix``
50-
or ``registerPrefixes`` methods::
50+
Para classes que seguem a nomeclatura padrão do PEAR, use o método ``registerPrefix``
51+
ou ``registerPrefixes`` ::
5152

5253
$loader->registerPrefix('Twig_', __DIR__.'/vendor/twig/lib');
5354

@@ -57,12 +58,12 @@ or ``registerPrefixes`` methods::
5758
));
5859

5960
.. note::
60-
Some libraries also need that their root path be registered in the PHP include
61-
path (``set_include_path()``).
61+
Algumas bibliotecas também precisam que o caminho da raiz seja registrado no include path do
62+
PHP (``set_include_path()``).
6263

63-
Classes from a sub-namespace or a sub-hierarchy of PEAR classes can be looked
64-
for in a list of locations to ease the vendoring of a sub-set of classes for
65-
large projects::
64+
Classes de um sub-namespace ou de uma sub-hierarquia de classes PEAR poden ser procuradas
65+
em uma lista de locais para facilitar o agrupamento de um sub-conjunto de classes para
66+
grandes projetos::
6667

6768
$loader->registerNamespaces(array(
6869
'Doctrine\Common' => __DIR__.'/vendor/doctrine/lib/vendor/doctrine-common/lib',
@@ -71,11 +72,11 @@ large projects::
7172
'Doctrine' => __DIR__.'/vendor/doctrine/lib',
7273
));
7374

74-
In this example, if you try to use a class in the ``Doctrine\Common`` namespace
75-
or one of its children, the autoloader will first look for the class under the
76-
``doctrine-common`` directory, and it will then fallback to the default
77-
``Doctrine`` directory (the last one configured) if not found, before giving up.
78-
The order of the registrations is significant in this case.
75+
Neste exemplo, se você tentar usar a classe no namespace ``Doctrine\Common``
76+
ou em um dos seus filhos, o autoloader vai procurar primeiro pela classe no
77+
diretório ``doctrine-common``, e vai procurar no diretório padrão
78+
``Doctrine`` (o último configurado) se não encontrar, antes de desistir.
79+
A ordem dos registros é importante neste caso.
7980

80-
.. _standards: http://groups.google.com/group/php-standards/web/psr-0-final-proposal
81+
.. _normas: http://groups.google.com/group/php-standards/web/psr-0-final-proposal
8182
.. _PEAR: http://pear.php.net/manual/en/standards.php

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.