cvs: phpdoc-es /reference/classobj/functions get-class-methods.xml get-class-vars.xml get-object-vars.xml method-exists.xml

From: Date: Sun, 09 Jun 2002 11:04:52 +0000
Subject: cvs: phpdoc-es /reference/classobj/functions get-class-methods.xml get-class-vars.xml get-object-vars.xml method-exists.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969346276@lists.php.net to get a copy of this message
rafael Sun Jun 9 07:04:52 2002 EDT Modified files: /phpdoc-es/reference/classobj/functions get-class-methods.xml get-class-vars.xml get-object-vars.xml method-exists.xml Log: Translation updated to PHP 4.x

Index: phpdoc-es/reference/classobj/functions/get-class-methods.xml diff -u phpdoc-es/reference/classobj/functions/get-class-methods.xml:1.1 phpdoc-es/reference/classobj/functions/get-class-methods.xml:1.2 --- phpdoc-es/reference/classobj/functions/get-class-methods.xml:1.1 Sun Apr 14 20:13:07 2002 +++ phpdoc-es/reference/classobj/functions/get-class-methods.xml Sun Jun 9 07:04:51 2002 @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./es/functions/classobj.xml, last change in rev 1.1 --> -<!-- last change to 'get-class-methods' in en/ tree in rev 1.2 --> +<!-- $Revision: 1.2 $ --> +<!-- EN-Revision: 1.3 Maintainer: rafael Status: ready --> + <refentry id="function.get-class-methods"> <refnamediv> <refname>get_class_methods</refname> @@ -18,6 +19,72 @@ m&eacute;todos definidos en la clase especificada como <parameter>class_name</parameter>. </para> + <note> + <para> + A partir de PHP 4.0.6, se puede especificar el objeto a s&iacute; mismo + en vez de <parameter>class_name</parameter>. Por ejemplo: + <informalexample> + <programlisting> +<![CDATA[ +$class_methods = get_class_methods($my_class); // see below the full example +]]> + </programlisting> + </informalexample> + </para> + </note> + <para> + <example> + <title><function>get_class_methods</function> ejemplo</title> + <programlisting role="php"> +<![CDATA[ +<?php + +class myclass { + // constructor + function myclass() { + return(TRUE); + } + + // method 1 + function myfunc1() { + return(TRUE); + } + + // method 2 + function myfunc2() { + return(TRUE); + } +} + +$my_object = new myclass(); + +$class_methods = get_class_methods(get_class($my_object)); + +foreach ($class_methods as $method_name) { + echo "$method_name\n"; +} + +?> +]]> + </programlisting> + </example> + </para> + <para> + Producira: + <informalexample> + <programlisting> +<![CDATA[ +myclass +myfunc1 +myfunc2 +]]> + </programlisting> + </informalexample> + </para> + <simpara> + Ver tambi&eacute;n <function>get_class_vars</function> y + <function>get_object_vars</function>. + </simpara> </refsect1> </refentry> Index: phpdoc-es/reference/classobj/functions/get-class-vars.xml diff -u phpdoc-es/reference/classobj/functions/get-class-vars.xml:1.1 phpdoc-es/reference/classobj/functions/get-class-vars.xml:1.2 --- phpdoc-es/reference/classobj/functions/get-class-vars.xml:1.1 Sun Apr 14 20:13:07 2002 +++ phpdoc-es/reference/classobj/functions/get-class-vars.xml Sun Jun 9 07:04:51 2002 @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./es/functions/classobj.xml, last change in rev 1.1 --> -<!-- last change to 'get-class-vars' in en/ tree in rev 1.1 --> +<!-- $Revision: 1.2 $ --> +<!-- EN-Revision: 1.3 Maintainer: rafael Status: ready --> + <refentry id="function.get-class-vars"> <refnamediv> <refname>get_class_vars</refname> @@ -16,8 +17,62 @@ </methodsynopsis> <para> Esta funci&oacute;n devuelve un vector con las propiedades que - han sido inicializadas por defecto en la clase. + han sido inicializadas por defecto en la clase. Los elementos de este vector + est&aacute;n estan organizados de la forma <parameter>varname => value</parameter>. </para> +<note> + <para> + Las variables de la clase que no est&eacute;n inicializadas, no ser&aacute; presentadas + por <function>get_class_vars</function>. + </para> + </note> + <para> + <example> + <title><function>get_class_vars</function> ejemplo</title> + <programlisting role="php"> +<![CDATA[ +<?php + +class myclass { + + var $var1; // this has no default value... + var $var2 = "xyz"; + var $var3 = 100; + + // constructor + function myclass() { + return(TRUE); + } +} + +$my_class = new myclass(); + +$class_vars = get_class_vars(get_class($my_class)); + +foreach ($class_vars as $name => $value) { + echo "$name : $value\n"; +} + +?> +]]> + </programlisting> + </example> + </para> + <para> + Producira: + <informalexample> + <programlisting> +<![CDATA[ +var2 : xyz +var3 : 100 +]]> + </programlisting> + </informalexample> + </para> + <simpara> + Ver tambi&eacute;n <function>get_class_methods</function>, + <function>get_object_vars</function> + </simpara> </refsect1> </refentry> Index: phpdoc-es/reference/classobj/functions/get-object-vars.xml diff -u phpdoc-es/reference/classobj/functions/get-object-vars.xml:1.1 phpdoc-es/reference/classobj/functions/get-object-vars.xml:1.2 --- phpdoc-es/reference/classobj/functions/get-object-vars.xml:1.1 Sun Apr 14 20:13:07 2002 +++ phpdoc-es/reference/classobj/functions/get-object-vars.xml Sun Jun 9 07:04:51 2002 @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./es/functions/classobj.xml, last change in rev 1.1 --> -<!-- last change to 'get-object-vars' in en/ tree in rev 1.1 --> +<!-- $Revision: 1.2 $ --> +<!-- EN-Revision: 1.2 Maintainer: rafael Status: ready --> + <refentry id="function.get-object-vars"> <refnamediv> <refname>get_object_vars</refname> @@ -13,9 +14,68 @@ <methodparam><type>object</type><parameter>obj</parameter></methodparam> </methodsynopsis> <para> - Esta funci&oacute;n devuelve un vector con las propiedades de objecto definidas - en el objecto especificado como <parameter>obj</parameter>. + Esta funci&oacute;n devuelve un vector con las propiedades definidas + en el objecto especificado como <parameter>obj</parameter>. Las variables + declaradas en la clase a la que pertenece <parameter>obj</parameter>, que no + les ha sido asignado un valor, no ser&aacute;n devueltas en el vector. +<example> + <title>Uso de <function>get_object_vars</function></title> + <programlisting role="php"> +<![CDATA[ +<?php +class Point2D { + var $x, $y; + var $label; + + function Point2D($x, $y) { + $this->x = $x; + $this->y = $y; + } + + function setLabel($label) { + $this->label = $label; + } + + function getPoint() { + return array("x" => $this->x, + "y" => $this->y, + "label" => $this->label); + } +} + +// "$label" is declared but not defined +$p1 = new Point2D(1.233, 3.445); +print_r(get_object_vars($p1)); + +$p1->setLabel("point #1"); +print_r(get_object_vars($p1)); + +?> +]]> + </programlisting> + </example> + El resultado de este programa es: + <screen> +<![CDATA[ + Array + ( + [x] => 1.233 + [y] => 3.445 + ) + + Array + ( + [x] => 1.233 + [y] => 3.445 + [label] => point #1 + ) +]]> + </screen> </para> + <simpara> + Ver tambien <function>get_class_methods</function> y + <function>get_class_vars</function>! + </simpara> </refsect1> </refentry> Index: phpdoc-es/reference/classobj/functions/method-exists.xml diff -u phpdoc-es/reference/classobj/functions/method-exists.xml:1.1 phpdoc-es/reference/classobj/functions/method-exists.xml:1.2 --- phpdoc-es/reference/classobj/functions/method-exists.xml:1.1 Sun Apr 14 20:13:07 2002 +++ phpdoc-es/reference/classobj/functions/method-exists.xml Sun Jun 9 07:04:51 2002 @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./es/functions/classobj.xml, last change in rev 1.1 --> -<!-- last change to 'method-exists' in en/ tree in rev 1.9 --> +<!-- $Revision: 1.2 $ --> +<!-- EN-Revision: 1.2 Maintainer: rafael Status: ready --> + <refentry id="function.method-exists"> <refnamediv> <refname>method_exists</refname> @@ -14,9 +15,9 @@ <methodparam><type>string</type><parameter>method_name</parameter></methodparam> </methodsynopsis> <para> - Esta funci&oacute;n devuelve verdadero si el met&oacute;do referido por + Esta funci&oacute;n devuelve verdadero (&true;) si el met&oacute;do referido por <parameter>method_name</parameter> ha sido definido en el objecto - <parameter>object</parameter>, en cualquier otro case devuelve falso + <parameter>object</parameter>, en cualquier otro caso devuelve falso (&false;) </para> </refsect1> </refentry>
« previous php.doc (#969346276) next »