-
Notifications
You must be signed in to change notification settings - Fork 15
Add translation for OOP files #123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lacatoire
wants to merge
2
commits into
php:master
Choose a base branch
from
lacatoire:add-oop-translations
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,130 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <!-- EN-Revision: 907f8ab64150c8503cb9f33d274ab6a7211b86a3 Maintainer: lacatoire Status: ready --> | ||
| <sect1 xml:id="language.oop5.final" xmlns="http://docbook.org/ns/docbook"> | ||
| <title>La parola chiave final</title> | ||
| <para> | ||
| La parola chiave final impedisce alle classi figlie di sovrascrivere un metodo, una proprietà o una costante | ||
| anteponendo alla definizione il prefisso <literal>final</literal>. Se la classe | ||
| stessa viene definita come final, non potrà essere estesa. | ||
| </para> | ||
| <para> | ||
| <example> | ||
| <title>Esempio di metodi final</title> | ||
| <programlisting role="php"> | ||
| <![CDATA[ | ||
| <?php | ||
| class BaseClass { | ||
| public function test() { | ||
| echo "BaseClass::test() called\n"; | ||
| } | ||
|
|
||
| final public function moreTesting() { | ||
| echo "BaseClass::moreTesting() called\n"; | ||
| } | ||
| } | ||
|
|
||
| class ChildClass extends BaseClass { | ||
| public function moreTesting() { | ||
| echo "ChildClass::moreTesting() called\n"; | ||
| } | ||
| } | ||
| // Results in Fatal error: Cannot override final method BaseClass::moreTesting() | ||
| ?> | ||
| ]]> | ||
| </programlisting> | ||
| </example> | ||
| </para> | ||
| <para> | ||
| <example> | ||
| <title>Esempio di classe final</title> | ||
| <programlisting role="php"> | ||
| <![CDATA[ | ||
| <?php | ||
| final class BaseClass { | ||
| public function test() { | ||
| echo "BaseClass::test() called\n"; | ||
| } | ||
|
|
||
| // As the class is already final, the final keyword is redundant | ||
|
lacatoire marked this conversation as resolved.
Outdated
|
||
| final public function moreTesting() { | ||
| echo "BaseClass::moreTesting() called\n"; | ||
| } | ||
| } | ||
|
|
||
| class ChildClass extends BaseClass { | ||
| } | ||
| // Results in Fatal error: Class ChildClass may not inherit from final class (BaseClass) | ||
|
lacatoire marked this conversation as resolved.
Outdated
|
||
| ?> | ||
| ]]> | ||
| </programlisting> | ||
| </example> | ||
| </para> | ||
| <example> | ||
| <title>Esempio di proprietà final a partire da PHP 8.4.0</title> | ||
| <programlisting role="php"> | ||
| <![CDATA[ | ||
| <?php | ||
| class BaseClass { | ||
| final protected string $test; | ||
| } | ||
|
|
||
| class ChildClass extends BaseClass { | ||
| public string $test; | ||
| } | ||
| // Results in Fatal error: Cannot override final property BaseClass::$test | ||
|
lacatoire marked this conversation as resolved.
Outdated
|
||
| ?> | ||
| ]]> | ||
| </programlisting> | ||
| </example> | ||
| <example xml:id="language.oop5.final.example.php81"> | ||
| <title>Esempio di costanti final a partire da PHP 8.1.0</title> | ||
| <programlisting role="php"> | ||
| <![CDATA[ | ||
| <?php | ||
| class Foo | ||
| { | ||
| final public const X = "foo"; | ||
| } | ||
|
|
||
| class Bar extends Foo | ||
| { | ||
| public const X = "bar"; | ||
| } | ||
|
|
||
| // Fatal error: Bar::X cannot override final constant Foo::X | ||
| ?> | ||
| ]]> | ||
| </programlisting> | ||
| </example> | ||
|
|
||
| <note> | ||
| <simpara> | ||
| A partire da PHP 8.0.0, i metodi privati non possono essere dichiarati final, ad eccezione del <link linkend="language.oop5.decon.constructor">costruttore</link>. | ||
|
lacatoire marked this conversation as resolved.
Outdated
|
||
| </simpara> | ||
| </note> | ||
| <note> | ||
| <simpara> | ||
| Una proprietà dichiarata <link linkend="language.oop5.visibility-members-aviz"><literal>private(set)</literal></link> è implicitamente <literal>final</literal>. | ||
| </simpara> | ||
| </note> | ||
| </sect1> | ||
| <!-- Keep this comment at the end of the file | ||
| Local variables: | ||
| mode: sgml | ||
| sgml-omittag:t | ||
| sgml-shorttag:t | ||
| sgml-minimize-attributes:nil | ||
| sgml-always-quote-attributes:t | ||
| sgml-indent-step:1 | ||
| sgml-indent-data:t | ||
| indent-tabs-mode:nil | ||
| sgml-parent-document:nil | ||
| sgml-default-dtd-file:"~/.phpdoc/manual.ced" | ||
| sgml-exposed-tags:nil | ||
| sgml-local-catalogs:nil | ||
| sgml-local-ecat-files:nil | ||
| End: | ||
| vim600: syn=xml fen fdm=syntax fdl=2 si | ||
| vim: et tw=78 syn=sgml | ||
| vi: ts=1 sw=1 | ||
| --> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <!-- EN-Revision: 1fb0ef23d7be0d8ecd9604fce16ee1e0842c6ef6 Maintainer: lacatoire Status: ready --> | ||
| <sect1 xml:id="language.oop5.iterations" xmlns="http://docbook.org/ns/docbook"> | ||
| <title>Iterazione degli oggetti</title> | ||
| <para> | ||
|
|
||
| PHP fornisce un modo per definire gli oggetti in modo tale che sia possibile iterare | ||
| attraverso un elenco di elementi, ad esempio con un'istruzione &foreach;. Per impostazione predefinita, | ||
| tutte le proprietà <link linkend="language.oop5.visibility">visibili</link> verranno utilizzate | ||
| per l'iterazione. | ||
|
|
||
| </para> | ||
|
|
||
| <example> | ||
| <title>Iterazione semplice degli oggetti</title> | ||
| <programlisting role="php"> | ||
| <![CDATA[ | ||
| <?php | ||
| class MyClass | ||
| { | ||
| public $var1 = 'value 1'; | ||
| public $var2 = 'value 2'; | ||
| public $var3 = 'value 3'; | ||
|
|
||
| protected $protected = 'protected var'; | ||
| private $private = 'private var'; | ||
|
|
||
| function iterateVisible() { | ||
| echo "MyClass::iterateVisible:\n"; | ||
| foreach ($this as $key => $value) { | ||
| print "$key => $value\n"; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| $class = new MyClass(); | ||
|
|
||
| foreach($class as $key => $value) { | ||
| print "$key => $value\n"; | ||
| } | ||
| echo "\n"; | ||
|
|
||
|
|
||
| $class->iterateVisible(); | ||
|
|
||
| ?> | ||
| ]]> | ||
| </programlisting> | ||
| &example.outputs; | ||
| <screen role="php"> | ||
| <![CDATA[ | ||
| var1 => value 1 | ||
| var2 => value 2 | ||
| var3 => value 3 | ||
|
|
||
| MyClass::iterateVisible: | ||
| var1 => value 1 | ||
| var2 => value 2 | ||
| var3 => value 3 | ||
| protected => protected var | ||
| private => private var | ||
| ]]> | ||
| </screen> | ||
|
|
||
| </example> | ||
|
|
||
| <para> | ||
| Come mostra l'output, il &foreach; ha iterato attraverso tutte le | ||
| proprietà <link linkend="language.oop5.visibility">visibili</link> a cui era possibile | ||
| accedere. | ||
| </para> | ||
|
|
||
| <simplesect role="seealso"> | ||
| &reftitle.seealso; | ||
| <para> | ||
| <simplelist> | ||
| <member><link linkend="language.generators">Generatori</link></member> | ||
| <member><interfacename>Iterator</interfacename></member> | ||
| <member><interfacename>IteratorAggregate</interfacename> </member> | ||
| <member><link linkend="spl.iterators">Iteratori SPL</link></member> | ||
| </simplelist> | ||
| </para> | ||
| </simplesect> | ||
|
|
||
| </sect1> | ||
| <!-- Keep this comment at the end of the file | ||
| Local variables: | ||
| mode: sgml | ||
| sgml-omittag:t | ||
| sgml-shorttag:t | ||
| sgml-minimize-attributes:nil | ||
| sgml-always-quote-attributes:t | ||
| sgml-indent-step:1 | ||
| sgml-indent-data:t | ||
| indent-tabs-mode:nil | ||
| sgml-parent-document:nil | ||
| sgml-default-dtd-file:"~/.phpdoc/manual.ced" | ||
| sgml-exposed-tags:nil | ||
| sgml-local-catalogs:nil | ||
| sgml-local-ecat-files:nil | ||
| End: | ||
| vim600: syn=xml fen fdm=syntax fdl=2 si | ||
| vim: et tw=78 syn=sgml | ||
| vi: ts=1 sw=1 | ||
| --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <!-- EN-Revision: a9edd62d087ab1eb6292c795b7256e14ff9f1234 Maintainer: lacatoire Status: ready --> | ||
| <sect1 xml:id="language.oop5.object-comparison" xmlns="http://docbook.org/ns/docbook"> | ||
| <title>Confronto tra oggetti</title> | ||
| <para> | ||
| Quando si utilizza l'operatore di confronto (<literal>==</literal>), | ||
| le variabili oggetto vengono confrontate in modo semplice, ovvero: due istanze | ||
| di oggetto sono uguali se hanno gli stessi attributi e valori (i valori vengono confrontati con <literal>==</literal>) e sono | ||
| istanze della stessa classe. | ||
| </para> | ||
| <para> | ||
| Quando si utilizza l'operatore di identità (<literal>===</literal>), | ||
| le variabili oggetto sono identiche se e solo se si riferiscono alla stessa | ||
| istanza della stessa classe. | ||
| </para> | ||
| <para> | ||
| Un esempio chiarirà queste regole. | ||
| <example> | ||
| <title>Esempio di confronto tra oggetti</title> | ||
| <programlisting role="php"> | ||
| <![CDATA[ | ||
| <?php | ||
| function bool2str($bool) | ||
| { | ||
| if ($bool === false) { | ||
| return 'FALSE'; | ||
| } else { | ||
| return 'TRUE'; | ||
| } | ||
| } | ||
|
|
||
| function compareObjects(&$o1, &$o2) | ||
| { | ||
| echo 'o1 == o2 : ' . bool2str($o1 == $o2) . "\n"; | ||
| echo 'o1 != o2 : ' . bool2str($o1 != $o2) . "\n"; | ||
| echo 'o1 === o2 : ' . bool2str($o1 === $o2) . "\n"; | ||
| echo 'o1 !== o2 : ' . bool2str($o1 !== $o2) . "\n"; | ||
| } | ||
|
|
||
| class Flag | ||
| { | ||
| public $flag; | ||
|
|
||
| function __construct($flag = true) { | ||
| $this->flag = $flag; | ||
| } | ||
| } | ||
|
|
||
| class OtherFlag | ||
| { | ||
| public $flag; | ||
|
|
||
| function __construct($flag = true) { | ||
| $this->flag = $flag; | ||
| } | ||
| } | ||
|
|
||
| $o = new Flag(); | ||
| $p = new Flag(); | ||
| $q = $o; | ||
| $r = new OtherFlag(); | ||
|
|
||
| echo "Two instances of the same class\n"; | ||
| compareObjects($o, $p); | ||
|
|
||
| echo "\nTwo references to the same instance\n"; | ||
| compareObjects($o, $q); | ||
|
|
||
| echo "\nInstances of two different classes\n"; | ||
| compareObjects($o, $r); | ||
| ?> | ||
| ]]> | ||
| </programlisting> | ||
| &example.outputs; | ||
| <screen> | ||
| <![CDATA[ | ||
| Two instances of the same class | ||
| o1 == o2 : TRUE | ||
| o1 != o2 : FALSE | ||
| o1 === o2 : FALSE | ||
| o1 !== o2 : TRUE | ||
|
|
||
| Two references to the same instance | ||
| o1 == o2 : TRUE | ||
| o1 != o2 : FALSE | ||
| o1 === o2 : TRUE | ||
| o1 !== o2 : FALSE | ||
|
|
||
| Instances of two different classes | ||
| o1 == o2 : FALSE | ||
| o1 != o2 : TRUE | ||
| o1 === o2 : FALSE | ||
| o1 !== o2 : TRUE | ||
| ]]> | ||
| </screen> | ||
| </example> | ||
| </para> | ||
| <note> | ||
| <para> | ||
| Le estensioni possono definire le proprie regole per il confronto dei loro oggetti | ||
| (<literal>==</literal>). | ||
| </para> | ||
| </note> | ||
| </sect1> | ||
| <!-- Keep this comment at the end of the file | ||
| Local variables: | ||
| mode: sgml | ||
| sgml-omittag:t | ||
| sgml-shorttag:t | ||
| sgml-minimize-attributes:nil | ||
| sgml-always-quote-attributes:t | ||
| sgml-indent-step:1 | ||
| sgml-indent-data:t | ||
| indent-tabs-mode:nil | ||
| sgml-parent-document:nil | ||
| sgml-default-dtd-file:"~/.phpdoc/manual.ced" | ||
| sgml-exposed-tags:nil | ||
| sgml-local-catalogs:nil | ||
| sgml-local-ecat-files:nil | ||
| End: | ||
| vim600: syn=xml fen fdm=syntax fdl=2 si | ||
| vim: et tw=78 syn=sgml | ||
| vi: ts=1 sw=1 | ||
| --> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.