Development

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

You must first sign up to be able to contribute.

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

Revision 12141, 1.6 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/PHP5ExtensionPeerBuilder.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 SfExtensionPeerBuilder extends PHP5ExtensionPeerBuilder
20 {
21   public function build()
22   {
23     $code = parent::build();
24     if (!DataModelBuilder::getBuildProperty('builderAddComments'))
25     {
26       $code = sfToolkit::stripComments($code);
27     }
28
29     return $code;
30   }
31
32   protected function addIncludes(&$script)
33   {
34     if (!DataModelBuilder::getBuildProperty('builderAddIncludes'))
35     {
36       return;
37     }
38
39     parent::addIncludes($script);
40   }
41
42   /**
43    * Adds class phpdoc comment and openning of class.
44    *
45    * @param string &$script The script will be modified in this method
46    */
47   protected function addClassOpen(&$script)
48   {
49     parent::addClassOpen($script);
50
51     // remove comments and fix coding standards
52     $script = str_replace(array(" {\n", "\n\n\n"), array("\n{", "\n"), sfToolkit::stripComments($script));
53   }
54
55   /**
56    * Closes class.
57    *
58    * @param string &$script The script will be modified in this method
59    */
60   protected function addClassClose(&$script)
61   {
62     parent::addClassClose($script);
63
64     // fix coding standards
65     $script = preg_replace('#} // .+$#m', '}', $script);
66   }
67 }
68
Note: See TracBrowser for help on using the browser.