Development

/branches/1.2/lib/plugins/sfPropelPlugin/lib/builder/SfExtensionObjectBuilder.php

You must first sign up to be able to contribute.

root/branches/1.2/lib/plugins/sfPropelPlugin/lib/builder/SfExtensionObjectBuilder.php

Revision 12141, 1.8 kB (checked in by fabien, 6 years ago)

[1.2] fixed coding standard of default Propel generated empty classes

  • Property svn:mime-type set to text/x-php
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1 <?php
2
3 require_once 'propel/engine/builder/om/php5/PHP5ExtensionObjectBuilder.php';
4
5 /*
6  * This file is part of the symfony package.
7  * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
8  *
9  * For the full copyright and license information, please view the LICENSE
10  * file that was distributed with this source code.
11  */
12
13 /**
14  * @package    symfony
15  * @subpackage propel
16  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
17  * @version    SVN: $Id$
18  */
19 class SfExtensionObjectBuilder extends PHP5ExtensionObjectBuilder
20 {
21
22   public function build()
23   {
24     $code = parent::build();
25     if (!DataModelBuilder::getBuildProperty('builderAddComments'))
26     {
27       $code = sfToolkit::stripComments($code);
28     }
29
30     return $code;
31   }
32
33   protected function addIncludes(&$script)
34   {
35     if (!DataModelBuilder::getBuildProperty('builderAddIncludes'))
36     {
37       return;
38     }
39
40     parent::addIncludes($script);
41   }
42
43   /**
44    * Adds class phpdoc comment and openning of class.
45    *
46    * @param string &$script The script will be modified in this method
47    */
48   protected function addClassOpen(&$script)
49   {
50     parent::addClassOpen($script);
51
52     // remove comments and fix coding standards
53     $script = str_replace(array(" {\n", "\n\n\n"), array("\n{", "\n"), sfToolkit::stripComments($script));
54   }
55
56   /**
57       * Adds the applyDefaults() method, which is called from the constructor.
58       *
59       * @param string &$script The script will be modified in this method.
60       */
61   protected function addConstructor(&$script)
62   {
63   }
64
65   /**
66    * Closes class.
67    *
68    * @param string &$script The script will be modified in this method
69    */
70   protected function addClassClose(&$script)
71   {
72     parent::addClassClose($script);
73
74     // fix coding standards
75     $script = preg_replace('#} // .+$#m', '}', $script);
76   }
77 }
78
Note: See TracBrowser for help on using the browser.