Login   Register  
PHP Classes
elePHPant
Icontem

File: examples/enum_example_doc.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Oliver Anan  >  PHP One Line Enum  >  examples/enum_example_doc.php  >  Download  
File: examples/enum_example_doc.php
Role: Example script
Content type: text/plain
Description: example how to document enumerations
Class: PHP One Line Enum
Create enumerated types from arrays of values
Author: By
Last change:
Date: 2011-04-23 12:52
Size: 547 bytes
 

Contents

Class file image Download
<?php
/**
 * To include an eumeration into a generated documentation, and enable
 * autocomplete in an IDE you can document a fake class that
 * is never loaded.
 */
namespace Geo;
require 
'../class/Co3/CodeGen/Enum.php';
use 
Co3\CodeGen\Enum as Enum;

if(
0){//unreachable code    
    /**
     * An Enumeration of geographical directions
     * Members: North,East,South,West
     */
    
class Direction extends Enum{
        const 
North=0,East=1,South=2,West=3;    
    }
}
//real code
Enum::create('Geo\Direction',array('North','East','South','West'));