# 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
    00015     final class DaoBuilder extends OnceBuilder
    00016     {
    00017         public static function build(MetaClass $class)
    00018         {
    00019             $out = self::getHead();
    00020
    00021             $type = $class->getType();
    00022
    00023             if ($type) {
    00024                 switch ($type->getId()) {
    00025
    00026                     case MetaClassType::CLASS_ABSTRACT:
    00027
    00028                         $abstract = 'abstract ';
    00029                         $notes = 'nothing here yet';
    00030
    00031                         break;
    00032
    00033                     case MetaClassType::CLASS_FINAL:
    00034
    00035                         $abstract = 'final ';
    00036                         $notes = 'last chance for customization';
    00037
    00038                         break;
    00039
    00040                     default:
    00041
    00042                         throw new WrongStateException('unknown class type');
    00043                 }
    00044             } else {
    00045                 $abstract = null;
    00046                 $notes = 'your brilliant stuff goes here';
    00047             }
    00048
    00049             $out .= <<<EOT
    00050 {$abstract}class {$class->getName()}DAO extends Auto{$class->getName()}DAO
    00051 {
    00052     // {$notes}
    00053 }
    00054
    00055 EOT;
    00056
    00057             return $out.self::getHeel();
    00058         }
    00059     }
    00060 ?>