Diese Seite auf Deutsch Deutsch auf allen Seiten print search BITPlan

These examples were generated with the PHP language generator. The UML2PHP products approach is more sophisticated than this. These examples are for showing some simple transformations from UML constructs to PHP code.

Class only

/com/bitplan/webpage/products/uml2php/examplecode/ClassCustomerOnly.gif
test/classCustomer.php line 35 - 47
<?php
/**
 *
 * @package Customer
 * DocBlock
 */

class Customer
{

    
// >>>{User defined global section}{::test::Customer}{S406EFBA0005A}
    // no implementation yet !!!
    // <<<{User defined global section}{::test::Customer}{S406EFBA0005A}

...
line 51 - 59
<?php
/**
 *
 */
    
function Customer() {
    
// >>>{DefaultConstructor }{Customer}{S406EFBA0005A}
    // no implementation yet !!!
    // <<<{DefaultConstructor }{Customer}{S406EFBA0005A}
    
// Customer
// Customer

Class with date attribute

/com/bitplan/webpage/products/uml2php/examplecode/ClassWithDateAttribute.gif
test/classCustomer.php line 45 - 55
<?php
/**
 *    Attributes for Customer
 */

/**
 * @var date firstContact;
 * the date of the first contact;
 */
        
protected  $firstContact;
        public function 
getfirstContact()             { return $this->firstContact; }
        public function 
setfirstContact($value) { $this->firstContact $value; }

Class with class attribute

/com/bitplan/webpage/products/uml2php/examplecode/ClassCustomerWithClassAttribute.gif
test/classCustomer.php line 45 - 54
<?php
/**
 *    static Attributes for Customer
 */
/**
 * @var short count;
 * ;
 */
        
protected static  $count;
        public static function 
getcount()             { return $this->count; }
        public static function 
setcount($value) { $this->count $value; }

Class with 1:1 association

/com/bitplan/webpage/products/uml2php/examplecode/ClassWith11Association.gif
test/classPerson.php line 45 - 109
<?php
/**
 *    Roles for Person
 */
/**
 * ;
 * @access public
 */
/**
 * check validity of myAddress
 *
 */
    
public function checkValidmyAddress($pAddress,$msg) {
    
// >>>{check valid }{myAddress}{S40F281E800C1}
    // no implementation yet !!!
    // <<<{check valid }{myAddress}{S40F281E800C1}
        
if ($pAddress==null)
            throw new 
Exception($msg."myAddress(Address pAddress) called with null parameter");
        if (!
$pAddress instanceof Address    )
            throw new 
Exception($msg."myAddress(Address pAddress) called with invalid parameter");
    } 
// checkValidmyAddress

   
protected $ref_myAddress NULL;

/**
 * Get access function for myAddress in CORBA notation
 */
    
public function myAddress() {
    
// >>>{Single Role Access}{myAddress}{S40F281E800CB}
    // no implementation yet !!!
    // <<<{Single Role Access}{myAddress}{S40F281E800CB}
        
return $this->ref_myAddress;
    } 
// myAddress

/**
 * Get access function for myAddress
 */
    
public function getmyAddress() {
    
// >>>{Get Single Role Access}{myAddress}{S40F281E800CB}
    // no implementation yet !!!
    // <<<{Get Single Role Access}{myAddress}{S40F281E800CB}
        
return $this->myAddress();
    } 
// getmyAddress

    /**
     * setter for myAddress in CORBA notation
     * @param pAddress The Address to be set
     * @throws Exception if setter for myAddress fails
     */
    
public function setDirectmyAddress($pAddress)  {
        
$this->ref_myAddress=$pAddress;
    
// >>>{Role setter }{myAddress}{S40F281E800C1}
    // no implementation yet !!!
    // <<<{Role setter }{myAddress}{S40F281E800C1}
    
// myAddress


/**
 * Set Access function for myAddress
 */
    
public function setmyAddress($_newrole) {
    
// >>>{Set Single Role Access}{myAddress}{S40F281E800CB}
    // no implementation yet !!!
    // <<<{Set Single Role Access}{myAddress}{S40F281E800CB}
        
$this->ref_myAddress $_newrole;
    } 
// setmyAddress
test/classAddress.php line 77 - 141
<?php
/**
 *    Roles for Address
 */
/**
 *    Default Constructor for Address
 */
/**
 *
 */
    
function Address() {
    
// >>>{DefaultConstructor }{Address}{S40F2731703AC}
    // no implementation yet !!!
    // <<<{DefaultConstructor }{Address}{S40F2731703AC}
    
// Address
// Address
?>

Class with abstract superclass

/com/bitplan/webpage/products/uml2php/examplecode/ClassWithAbstractSuperclass.gif
test/classPerson.php line 41 - 41
<?php
class Person
test/classCustomer.php line 41 - 41
<?php
class Customer extends Person

Class with derived attribute

/com/bitplan/webpage/products/uml2php/examplecode/ClassWithDerivedAttribute.gif
test/classPerson.php line 49 - 69
<?php
/**
 * @var short birthdate;
 * ;
 */
        
protected  $birthdate;
        public function 
getbirthdate()             { return $this->birthdate; }
        public function 
setbirthdate($value) { $this->birthdate $value; }
/**
 * @var short age;
 * ;
 */
        
public function getage() {
    
// >>>{derived getter}{age}{S40F26F340333}
    // no implementation yet !!!
    // <<<{derived getter}{age}{S40F26F340333}
        
}
        public function 
setage($newvalue) {
    
// >>>{derived setter}{age}{S40F26F340333}
    // no implementation yet !!!
    // <<<{derived setter}{age}{S40F26F340333}
        
}

Class with operation

/com/bitplan/webpage/products/uml2php/examplecode/ClassWithOperation.gif
test/classCustomer.php line 43 - 54
<?php
/**
 *    Operations for Customer
 */
/**
 *
 *
 */
    
public  function makeOrder() {
    
// >>>{Op }{makeOrder}{S40F271B0026F}
    // no implementation yet !!!
    // <<<{Op }{makeOrder}{S40F271B0026F}
    
// makeOrder

Class with Parameters and Return

/com/bitplan/webpage/products/uml2php/examplecode/ClassWithOperationWithParametersAndReturn.gif
test/classCalculator.php line 43 - 56
<?php
/**
 *    Operations for Calculator
 */
/**
 *
 *
 * @param a -
 * @param b -
 */
    
public  function add($a,$b) {
    
// >>>{Op }{add$a,$b}{S40F25775036C}
    // no implementation yet !!!
    // <<<{Op }{add$a,$b}{S40F25775036C}
    
// add

Class with Superclass and inherited association

/com/bitplan/webpage/products/uml2php/examplecode/ClassWithSuperclassAndInheritedAssociation.gif
test/classPerson.php line 42 - 94
<?php
/**
 *    Roles for Person
 */
/**
 * ;
 * @access public
 */
/**
 * check validity of myAddresses
 *
 */
    
public function checkValidmyAddresses($pAddress,$msg) {
    
// >>>{check valid }{myAddresses}{S40F27375020D}
    // no implementation yet !!!
    // <<<{check valid }{myAddresses}{S40F27375020D}
        
if ($pAddress==null)
            throw new 
Exception($msg."myAddresses(Address pAddress) called with null parameter");
        if (!
$pAddress instanceof Address    )
            throw new 
Exception($msg."myAddresses(Address pAddress) called with invalid parameter");
    } 
// checkValidmyAddresses

   
protected $ref_myAddresses = array();
   protected 
$ref_myAddresses_initialized false;

/**
 * multi get Access function for myAddresses
 */
    
public function myAddresses() {
    
// >>>{Multi Role Access}{myAddresses}{S40F27375020F}
    // no implementation yet !!!
    // <<<{Multi Role Access}{myAddresses}{S40F27375020F}
        
return $this->ref_myAddresses;
    } 
// myAddresses()

/**
 * Add Association Access function for role
 */
    
public function addTomyAddresses($_key$_value) {
    
// >>>{addTo Multi Role Access}{myAddresses}{S40F27375020F}
    // no implementation yet !!!
    // <<<{addTo Multi Role Access}{myAddresses}{S40F27375020F}
        
$this->ref_myAddresses[$_key] = $_value;
    } 
// addTomyAddresses

/**
 * Remove Association Access function for role
 */
    
public function removeFrommyAddresses($_key) {
    
// >>>{removeFrom Multi Role Access}{myAddresses}{S40F27375020F}
    // no implementation yet !!!
    // <<<{removeFrom Multi Role Access}{myAddresses}{S40F27375020F}
        
unset($this->ref_myAddresses[$_key]);
    } 
// removeFrommyAddresses
test/classCustomer.php line 35 - 35
<?php
class Customer extends Person
...
line 42 - 53
<?php
/**
 *    Default Constructor for Customer
 */
/**
 *
 */
    
function Customer() {
        
parent::Person();
    
// >>>{DefaultConstructor }{Customer}{S40F2671B018E}
    // no implementation yet !!!
    // <<<{DefaultConstructor }{Customer}{S40F2671B018E}
    
// Customer

Class with :1 association

/com/bitplan/webpage/products/uml2php/examplecode/ClassWith_1Association.gif
test/classAddress.php line 35 - 1034
<?php
class Address
{

    
// >>>{User defined global section}{::test::Address}{S40F2731703AC}
    // no implementation yet !!!
    // <<<{User defined global section}{::test::Address}{S40F2731703AC}

/**
 *    Attributes for Address
 */

/**
 * @var String street;
 * ;
 */
        
protected  $street;
        private function 
getstreet()             { return $this->street; }
        private function 
setstreet($value) { $this->street $value; }
/**
 * @var String city;
 * ;
 */
        
protected  $city;
        private function 
getcity()             { return $this->city; }
        private function 
setcity($value) { $this->city $value; }
/**
 * @var String zip;
 * ;
 */
        
protected  $zip;
        private function 
getzip()             { return $this->zip; }
        private function 
setzip($value) { $this->zip $value; }
/**
 * @var String country;
 * ;
 */
        
protected  $country;
        private function 
getcountry()             { return $this->country; }
        private function 
setcountry($value) { $this->country $value; }
/**
 *    Roles for Address
 */
/**
 *    Default Constructor for Address
 */
/**
 *
 */
    
function Address() {
    
// >>>{DefaultConstructor }{Address}{S40F2731703AC}
    // no implementation yet !!!
    // <<<{DefaultConstructor }{Address}{S40F2731703AC}
    
// Address
// Address
?>

Class with n:m association

/com/bitplan/webpage/products/uml2php/examplecode/ClassWithmnAssociation.gif
test/classAddress.php line 81 - 126
<?php
/**
 * check validity of myPersons
 *
 */
    
public function checkValidmyPersons($pPerson,$msg) {
    
// >>>{check valid }{myPersons}{S40F281E800CB}
    // no implementation yet !!!
    // <<<{check valid }{myPersons}{S40F281E800CB}
        
if ($pPerson==null)
            throw new 
Exception($msg."myPersons(Person pPerson) called with null parameter");
        if (!
$pPerson instanceof Person    )
            throw new 
Exception($msg."myPersons(Person pPerson) called with invalid parameter");
    } 
// checkValidmyPersons

   
protected $ref_myPersons = array();
   protected 
$ref_myPersons_initialized false;

/**
 * multi get Access function for myPersons
 */
    
public function myPersons() {
    
// >>>{Multi Role Access}{myPersons}{S40F281E800C1}
    // no implementation yet !!!
    // <<<{Multi Role Access}{myPersons}{S40F281E800C1}
        
return $this->ref_myPersons;
    } 
// myPersons()

/**
 * Add Association Access function for role
 */
    
public function addTomyPersons($_key$_value) {
    
// >>>{addTo Multi Role Access}{myPersons}{S40F281E800C1}
    // no implementation yet !!!
    // <<<{addTo Multi Role Access}{myPersons}{S40F281E800C1}
        
$this->ref_myPersons[$_key] = $_value;
    } 
// addTomyPersons

/**
 * Remove Association Access function for role
 */
    
public function removeFrommyPersons($_key) {
    
// >>>{removeFrom Multi Role Access}{myPersons}{S40F281E800C1}
    // no implementation yet !!!
    // <<<{removeFrom Multi Role Access}{myPersons}{S40F281E800C1}
        
unset($this->ref_myPersons[$_key]);
    } 
// removeFrommyPersons

Class with :n association

/com/bitplan/webpage/products/uml2php/examplecode/ClassWith_nAssociation.gif
test/classPerson.php line 49 - 94
<?php
/**
 * check validity of myAddresses
 *
 */
    
public function checkValidmyAddresses($pAddress,$msg) {
    
// >>>{check valid }{myAddresses}{S40F281E800C1}
    // no implementation yet !!!
    // <<<{check valid }{myAddresses}{S40F281E800C1}
        
if ($pAddress==null)
            throw new 
Exception($msg."myAddresses(Address pAddress) called with null parameter");
        if (!
$pAddress instanceof Address    )
            throw new 
Exception($msg."myAddresses(Address pAddress) called with invalid parameter");
    } 
// checkValidmyAddresses

   
protected $ref_myAddresses = array();
   protected 
$ref_myAddresses_initialized false;

/**
 * multi get Access function for myAddresses
 */
    
public function myAddresses() {
    
// >>>{Multi Role Access}{myAddresses}{S40F281E800CB}
    // no implementation yet !!!
    // <<<{Multi Role Access}{myAddresses}{S40F281E800CB}
        
return $this->ref_myAddresses;
    } 
// myAddresses()

/**
 * Add Association Access function for role
 */
    
public function addTomyAddresses($_key$_value) {
    
// >>>{addTo Multi Role Access}{myAddresses}{S40F281E800CB}
    // no implementation yet !!!
    // <<<{addTo Multi Role Access}{myAddresses}{S40F281E800CB}
        
$this->ref_myAddresses[$_key] = $_value;
    } 
// addTomyAddresses

/**
 * Remove Association Access function for role
 */
    
public function removeFrommyAddresses($_key) {
    
// >>>{removeFrom Multi Role Access}{myAddresses}{S40F281E800CB}
    // no implementation yet !!!
    // <<<{removeFrom Multi Role Access}{myAddresses}{S40F281E800CB}
        
unset($this->ref_myAddresses[$_key]);
    } 
// removeFrommyAddresses

Impressum  ©BITPlan 1999-2010 Valid XHTML 1.0 Transitional