DaoBuilder.class.php

Go to the documentation of this file.
00001 <?php
00002 /***************************************************************************
00003  *   Copyright (C) 2006-2007 by Konstantin V. Arkhipov                     *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU Lesser General Public License as        *
00007  *   published by the Free Software Foundation; either version 3 of the    *
00008  *   License, or (at your option) any later version.                       *
00009  *                                                                         *
00010  ***************************************************************************/
00011 /* $Id: DaoBuilder.class.php 4687 2007-12-09 18:57:18Z voxus $ */
00012 
00016     final class DaoBuilder extends OnceBuilder
00017     {
00018         public static function build(MetaClass $class)
00019         {
00020             $out = self::getHead();
00021             
00022             $type = $class->getType();
00023             
00024             if ($type) {
00025                 switch ($type->getId()) {
00026                     
00027                     case MetaClassType::CLASS_ABSTRACT:
00028                     
00029                         $abstract = 'abstract ';
00030                         $notes = 'nothing here yet';
00031                         
00032                         break;
00033                     
00034                     case MetaClassType::CLASS_FINAL:
00035                     
00036                         $abstract = 'final ';
00037                         $notes = 'last chance for customization';
00038                         
00039                         break;
00040                     
00041                     default:
00042                         
00043                         throw new WrongStateException('unknown class type');
00044                 }
00045             } else {
00046                 $abstract = null;
00047                 $notes = 'your brilliant stuff goes here';
00048             }
00049             
00050             $out .= <<<EOT
00051 {$abstract}class {$class->getName()}DAO extends Auto{$class->getName()}DAO
00052 {
00053     // {$notes}
00054 }
00055 
00056 EOT;
00057             
00058             return $out.self::getHeel();
00059         }
00060     }
00061 ?>

Generated on Sun Dec 9 21:56:24 2007 for onPHP by  doxygen 1.5.4