attempt to get baked code output closer to phpcs standard

This commit is contained in:
AD7six 2012-04-30 16:44:46 +02:00
parent 9001844396
commit d1f522e53a
3 changed files with 16 additions and 4 deletions

View file

@ -25,6 +25,7 @@
* *
*/ */
class <?php echo $model; ?>Fixture extends CakeTestFixture { class <?php echo $model; ?>Fixture extends CakeTestFixture {
<?php if ($table): ?> <?php if ($table): ?>
/** /**
* Table name * Table name
@ -32,6 +33,7 @@ class <?php echo $model; ?>Fixture extends CakeTestFixture {
* @var string * @var string
*/ */
public $table = '<?php echo $table; ?>'; public $table = '<?php echo $table; ?>';
<?php endif; ?> <?php endif; ?>
<?php if ($import): ?> <?php if ($import): ?>
/** /**
@ -40,8 +42,8 @@ class <?php echo $model; ?>Fixture extends CakeTestFixture {
* @var array * @var array
*/ */
public $import = <?php echo $import; ?>; public $import = <?php echo $import; ?>;
<?php endif; ?>
<?php endif; ?>
<?php if ($schema): ?> <?php if ($schema): ?>
/** /**
* Fields * Fields
@ -49,8 +51,8 @@ class <?php echo $model; ?>Fixture extends CakeTestFixture {
* @var array * @var array
*/ */
public $fields = <?php echo $schema; ?>; public $fields = <?php echo $schema; ?>;
<?php endif;?>
<?php endif;?>
<?php if ($records): ?> <?php if ($records): ?>
/** /**
* Records * Records
@ -58,5 +60,6 @@ class <?php echo $model; ?>Fixture extends CakeTestFixture {
* @var array * @var array
*/ */
public $records = <?php echo $records; ?>; public $records = <?php echo $records; ?>;
<?php endif;?> <?php endif;?>
} }

View file

@ -36,6 +36,7 @@ foreach (array('hasOne', 'belongsTo', 'hasMany', 'hasAndBelongsToMany') as $asso
?> ?>
*/ */
class <?php echo $name ?> extends <?php echo $plugin; ?>AppModel { class <?php echo $name ?> extends <?php echo $plugin; ?>AppModel {
<?php if ($useDbConfig != 'default'): ?> <?php if ($useDbConfig != 'default'): ?>
/** /**
* Use database config * Use database config
@ -43,11 +44,12 @@ class <?php echo $name ?> extends <?php echo $plugin; ?>AppModel {
* @var string * @var string
*/ */
public $useDbConfig = '<?php echo $useDbConfig; ?>'; public $useDbConfig = '<?php echo $useDbConfig; ?>';
<?php endif;?> <?php endif;?>
<?php if ($useTable && $useTable !== Inflector::tableize($name)): <?php if ($useTable && $useTable !== Inflector::tableize($name)):
$table = "'$useTable'"; $table = "'$useTable'";
echo "/**\n * Use table\n *\n * @var mixed False or table name\n */\n"; echo "/**\n * Use table\n *\n * @var mixed False or table name\n */\n";
echo "\tpublic \$useTable = $table;\n"; echo "\tpublic \$useTable = $table;\n\n";
endif; endif;
if ($primaryKey !== 'id'): ?> if ($primaryKey !== 'id'): ?>
/** /**
@ -56,6 +58,7 @@ if ($primaryKey !== 'id'): ?>
* @var string * @var string
*/ */
public $primaryKey = '<?php echo $primaryKey; ?>'; public $primaryKey = '<?php echo $primaryKey; ?>';
<?php endif; <?php endif;
if ($displayField): ?> if ($displayField): ?>
/** /**
@ -64,6 +67,7 @@ if ($displayField): ?>
* @var string * @var string
*/ */
public $displayField = '<?php echo $displayField; ?>'; public $displayField = '<?php echo $displayField; ?>';
<?php endif; <?php endif;
if (!empty($validate)): if (!empty($validate)):

View file

@ -29,6 +29,7 @@ App::uses('<?php echo $dependency[0]; ?>', '<?php echo $dependency[1]; ?>');
* *
*/ */
class Test<?php echo $fullClassName; ?> extends <?php echo $fullClassName; ?> { class Test<?php echo $fullClassName; ?> extends <?php echo $fullClassName; ?> {
/** /**
* Auto render * Auto render
* *
@ -55,13 +56,16 @@ class Test<?php echo $fullClassName; ?> extends <?php echo $fullClassName; ?> {
* *
*/ */
class <?php echo $fullClassName; ?>Test extends CakeTestCase { class <?php echo $fullClassName; ?>Test extends CakeTestCase {
<?php if (!empty($fixtures)): ?> <?php if (!empty($fixtures)): ?>
/** /**
* Fixtures * Fixtures
* *
* @var array * @var array
*/ */
public $fixtures = array('<?php echo join("', '", $fixtures); ?>'); public $fixtures = array(
'<?php echo join("',\n\t\t'", $fixtures); ?>'
);
<?php endif; ?> <?php endif; ?>
/** /**
@ -96,5 +100,6 @@ class <?php echo $fullClassName; ?>Test extends CakeTestCase {
public function test<?php echo Inflector::camelize($method); ?>() { public function test<?php echo Inflector::camelize($method); ?>() {
} }
<?php endforeach;?> <?php endforeach;?>
} }