Skip to content

Commit dd39dc2

Browse files
committed
Add Italian translation for OOP files (references, iterations, serialization, object-comparison, final)
1 parent 87512ff commit dd39dc2

5 files changed

Lines changed: 558 additions & 0 deletions

File tree

language/oop5/final.xml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- EN-Revision: 907f8ab64150c8503cb9f33d274ab6a7211b86a3 Maintainer: lacatoire Status: ready -->
3+
<sect1 xml:id="language.oop5.final" xmlns="http://docbook.org/ns/docbook">
4+
<title>La parola chiave final</title>
5+
<para>
6+
La parola chiave final impedisce alle classi figlie di sovrascrivere un metodo, una proprietà o una costante
7+
anteponendo alla definizione il prefisso <literal>final</literal>. Se la classe
8+
stessa viene definita come final, non potrà essere estesa.
9+
</para>
10+
<para>
11+
<example>
12+
<title>Esempio di metodi final</title>
13+
<programlisting role="php">
14+
<![CDATA[
15+
<?php
16+
class BaseClass {
17+
public function test() {
18+
echo "BaseClass::test() called\n";
19+
}
20+
21+
final public function moreTesting() {
22+
echo "BaseClass::moreTesting() called\n";
23+
}
24+
}
25+
26+
class ChildClass extends BaseClass {
27+
public function moreTesting() {
28+
echo "ChildClass::moreTesting() called\n";
29+
}
30+
}
31+
// Results in Fatal error: Cannot override final method BaseClass::moreTesting()
32+
?>
33+
]]>
34+
</programlisting>
35+
</example>
36+
</para>
37+
<para>
38+
<example>
39+
<title>Esempio di classe final</title>
40+
<programlisting role="php">
41+
<![CDATA[
42+
<?php
43+
final class BaseClass {
44+
public function test() {
45+
echo "BaseClass::test() called\n";
46+
}
47+
48+
// As the class is already final, the final keyword is redundant
49+
final public function moreTesting() {
50+
echo "BaseClass::moreTesting() called\n";
51+
}
52+
}
53+
54+
class ChildClass extends BaseClass {
55+
}
56+
// Results in Fatal error: Class ChildClass may not inherit from final class (BaseClass)
57+
?>
58+
]]>
59+
</programlisting>
60+
</example>
61+
</para>
62+
<example>
63+
<title>Esempio di proprietà final a partire da PHP 8.4.0</title>
64+
<programlisting role="php">
65+
<![CDATA[
66+
<?php
67+
class BaseClass {
68+
final protected string $test;
69+
}
70+
71+
class ChildClass extends BaseClass {
72+
public string $test;
73+
}
74+
// Results in Fatal error: Cannot override final property BaseClass::$test
75+
?>
76+
]]>
77+
</programlisting>
78+
</example>
79+
<example xml:id="language.oop5.final.example.php81">
80+
<title>Esempio di costanti final a partire da PHP 8.1.0</title>
81+
<programlisting role="php">
82+
<![CDATA[
83+
<?php
84+
class Foo
85+
{
86+
final public const X = "foo";
87+
}
88+
89+
class Bar extends Foo
90+
{
91+
public const X = "bar";
92+
}
93+
94+
// Fatal error: Bar::X cannot override final constant Foo::X
95+
?>
96+
]]>
97+
</programlisting>
98+
</example>
99+
100+
<note>
101+
<simpara>
102+
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>.
103+
</simpara>
104+
</note>
105+
<note>
106+
<simpara>
107+
Una proprietà dichiarata <link linkend="language.oop5.visibility-members-aviz"><literal>private(set)</literal></link> è implicitamente <literal>final</literal>.
108+
</simpara>
109+
</note>
110+
</sect1>
111+
<!-- Keep this comment at the end of the file
112+
Local variables:
113+
mode: sgml
114+
sgml-omittag:t
115+
sgml-shorttag:t
116+
sgml-minimize-attributes:nil
117+
sgml-always-quote-attributes:t
118+
sgml-indent-step:1
119+
sgml-indent-data:t
120+
indent-tabs-mode:nil
121+
sgml-parent-document:nil
122+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
123+
sgml-exposed-tags:nil
124+
sgml-local-catalogs:nil
125+
sgml-local-ecat-files:nil
126+
End:
127+
vim600: syn=xml fen fdm=syntax fdl=2 si
128+
vim: et tw=78 syn=sgml
129+
vi: ts=1 sw=1
130+
-->

language/oop5/iterations.xml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- EN-Revision: 1fb0ef23d7be0d8ecd9604fce16ee1e0842c6ef6 Maintainer: lacatoire Status: ready -->
3+
<sect1 xml:id="language.oop5.iterations" xmlns="http://docbook.org/ns/docbook">
4+
<title>Iterazione degli oggetti</title>
5+
<para>
6+
7+
PHP fornisce un modo per definire gli oggetti in modo tale che sia possibile iterare
8+
attraverso un elenco di elementi, ad esempio con un'istruzione &foreach;. Per impostazione predefinita,
9+
tutte le proprietà <link linkend="language.oop5.visibility">visibili</link> verranno utilizzate
10+
per l'iterazione.
11+
12+
</para>
13+
14+
<example>
15+
<title>Iterazione semplice degli oggetti</title>
16+
<programlisting role="php">
17+
<![CDATA[
18+
<?php
19+
class MyClass
20+
{
21+
public $var1 = 'value 1';
22+
public $var2 = 'value 2';
23+
public $var3 = 'value 3';
24+
25+
protected $protected = 'protected var';
26+
private $private = 'private var';
27+
28+
function iterateVisible() {
29+
echo "MyClass::iterateVisible:\n";
30+
foreach ($this as $key => $value) {
31+
print "$key => $value\n";
32+
}
33+
}
34+
}
35+
36+
$class = new MyClass();
37+
38+
foreach($class as $key => $value) {
39+
print "$key => $value\n";
40+
}
41+
echo "\n";
42+
43+
44+
$class->iterateVisible();
45+
46+
?>
47+
]]>
48+
</programlisting>
49+
&example.outputs;
50+
<screen role="php">
51+
<![CDATA[
52+
var1 => value 1
53+
var2 => value 2
54+
var3 => value 3
55+
56+
MyClass::iterateVisible:
57+
var1 => value 1
58+
var2 => value 2
59+
var3 => value 3
60+
protected => protected var
61+
private => private var
62+
]]>
63+
</screen>
64+
65+
</example>
66+
67+
<para>
68+
Come mostra l'output, il &foreach; ha iterato attraverso tutte le
69+
proprietà <link linkend="language.oop5.visibility">visibili</link> a cui era possibile
70+
accedere.
71+
</para>
72+
73+
<simplesect role="seealso">
74+
&reftitle.seealso;
75+
<para>
76+
<simplelist>
77+
<member><link linkend="language.generators">Generatori</link></member>
78+
<member><interfacename>Iterator</interfacename></member>
79+
<member><interfacename>IteratorAggregate</interfacename> </member>
80+
<member><link linkend="spl.iterators">Iteratori SPL</link></member>
81+
</simplelist>
82+
</para>
83+
</simplesect>
84+
85+
</sect1>
86+
<!-- Keep this comment at the end of the file
87+
Local variables:
88+
mode: sgml
89+
sgml-omittag:t
90+
sgml-shorttag:t
91+
sgml-minimize-attributes:nil
92+
sgml-always-quote-attributes:t
93+
sgml-indent-step:1
94+
sgml-indent-data:t
95+
indent-tabs-mode:nil
96+
sgml-parent-document:nil
97+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
98+
sgml-exposed-tags:nil
99+
sgml-local-catalogs:nil
100+
sgml-local-ecat-files:nil
101+
End:
102+
vim600: syn=xml fen fdm=syntax fdl=2 si
103+
vim: et tw=78 syn=sgml
104+
vi: ts=1 sw=1
105+
-->
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- EN-Revision: a9edd62d087ab1eb6292c795b7256e14ff9f1234 Maintainer: lacatoire Status: ready -->
3+
<sect1 xml:id="language.oop5.object-comparison" xmlns="http://docbook.org/ns/docbook">
4+
<title>Confronto tra oggetti</title>
5+
<para>
6+
Quando si utilizza l'operatore di confronto (<literal>==</literal>),
7+
le variabili oggetto vengono confrontate in modo semplice, ovvero: due istanze
8+
di oggetto sono uguali se hanno gli stessi attributi e valori (i valori vengono confrontati con <literal>==</literal>) e sono
9+
istanze della stessa classe.
10+
</para>
11+
<para>
12+
Quando si utilizza l'operatore di identità (<literal>===</literal>),
13+
le variabili oggetto sono identiche se e solo se si riferiscono alla stessa
14+
istanza della stessa classe.
15+
</para>
16+
<para>
17+
Un esempio chiarirà queste regole.
18+
<example>
19+
<title>Esempio di confronto tra oggetti</title>
20+
<programlisting role="php">
21+
<![CDATA[
22+
<?php
23+
function bool2str($bool)
24+
{
25+
if ($bool === false) {
26+
return 'FALSE';
27+
} else {
28+
return 'TRUE';
29+
}
30+
}
31+
32+
function compareObjects(&$o1, &$o2)
33+
{
34+
echo 'o1 == o2 : ' . bool2str($o1 == $o2) . "\n";
35+
echo 'o1 != o2 : ' . bool2str($o1 != $o2) . "\n";
36+
echo 'o1 === o2 : ' . bool2str($o1 === $o2) . "\n";
37+
echo 'o1 !== o2 : ' . bool2str($o1 !== $o2) . "\n";
38+
}
39+
40+
class Flag
41+
{
42+
public $flag;
43+
44+
function __construct($flag = true) {
45+
$this->flag = $flag;
46+
}
47+
}
48+
49+
class OtherFlag
50+
{
51+
public $flag;
52+
53+
function __construct($flag = true) {
54+
$this->flag = $flag;
55+
}
56+
}
57+
58+
$o = new Flag();
59+
$p = new Flag();
60+
$q = $o;
61+
$r = new OtherFlag();
62+
63+
echo "Two instances of the same class\n";
64+
compareObjects($o, $p);
65+
66+
echo "\nTwo references to the same instance\n";
67+
compareObjects($o, $q);
68+
69+
echo "\nInstances of two different classes\n";
70+
compareObjects($o, $r);
71+
?>
72+
]]>
73+
</programlisting>
74+
&example.outputs;
75+
<screen>
76+
<![CDATA[
77+
Two instances of the same class
78+
o1 == o2 : TRUE
79+
o1 != o2 : FALSE
80+
o1 === o2 : FALSE
81+
o1 !== o2 : TRUE
82+
83+
Two references to the same instance
84+
o1 == o2 : TRUE
85+
o1 != o2 : FALSE
86+
o1 === o2 : TRUE
87+
o1 !== o2 : FALSE
88+
89+
Instances of two different classes
90+
o1 == o2 : FALSE
91+
o1 != o2 : TRUE
92+
o1 === o2 : FALSE
93+
o1 !== o2 : TRUE
94+
]]>
95+
</screen>
96+
</example>
97+
</para>
98+
<note>
99+
<para>
100+
Le estensioni possono definire le proprie regole per il confronto dei loro oggetti
101+
(<literal>==</literal>).
102+
</para>
103+
</note>
104+
</sect1>
105+
<!-- Keep this comment at the end of the file
106+
Local variables:
107+
mode: sgml
108+
sgml-omittag:t
109+
sgml-shorttag:t
110+
sgml-minimize-attributes:nil
111+
sgml-always-quote-attributes:t
112+
sgml-indent-step:1
113+
sgml-indent-data:t
114+
indent-tabs-mode:nil
115+
sgml-parent-document:nil
116+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
117+
sgml-exposed-tags:nil
118+
sgml-local-catalogs:nil
119+
sgml-local-ecat-files:nil
120+
End:
121+
vim600: syn=xml fen fdm=syntax fdl=2 si
122+
vim: et tw=78 syn=sgml
123+
vi: ts=1 sw=1
124+
-->

0 commit comments

Comments
 (0)