Poseidon PHP4 Code Generation Plug-in Guide

» PDF PDF Version =>

This guide is based on the PHP4 Manual, available at: www.php.net/docs.php

General Rules

  • The only classifier in PHP4 is Class
  • PHP4 Class can not participate in an Association.
  • There is no Exception in PHP4.
  • There are two files generated for each Class generation process:
    1. '.inc' file that contains class declaration
    2. '.php' file which includes related '.inc' on its first line

Tagged values

The following tagged value keys are supported for PHP4 Class:

  • '<<<' for Heredoc string
  • 'initval' for an initial value of an operation parameter
  • '&' for operation parameter passed by reference
  • '&' for a function that returns a reference

PHP4 Class Modelling Rules

  • Use standard UML 'Class'
  • Only supports single inheritance

Class Signature

  • There are no visibilities for Class Signature
  • There are no modifiers for Class Signature

Class Attributes

  • There are no visibilities for Class Attributes.
  • Tagged values supported:
    1. Heredoc

      Tagged value = '<<<', with value = 'true'
      Will return anything typed in the initial value with Heredoc string type:

      Example:
      $str = <<<EOD
      Example of string
      spanning multiple lines
      using heredoc syntax.
      EOD;

Class Operations

  • There are no visibilities for Class Operations.
  • Tagged values supported:
    1. Parameter initial value
      Tagged value= 'initval', with value = (specified parameter initial value).

      Example:

      class ConstructorCart extends Cart {
         function ConstructorCart($item = "10", $num = 1)  {
            $this->add_item ($item, $num);
         }
      }

    2. Parameter passed by reference
      Tagged value='&' with value='true' in the parameter signature.

      Example:

      <?php
      function foo (&$var) {
         $var++;
      }
      
      $a=5;
      foo ($a);
      // $a is 6 here
      ?>

    3. Function returns a reference
      Tagged value='&' with value='true' in the operation signature.

      Example:

      <?php
      function &returns_reference() {
         return $someref;
      }
      
      $newref =& returns_reference();
      ?>



© 2000 - 2010 Gentleware AG
         
                        
 support  documentation  php4