Skip to content

Commit

Permalink
attempt to get baked code output closer to phpcs standard
Browse files Browse the repository at this point in the history
  • Loading branch information
AD7six committed May 9, 2012
1 parent 9001844 commit d1f522e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
7 changes: 5 additions & 2 deletions lib/Cake/Console/Templates/default/classes/fixture.ctp
Expand Up @@ -25,13 +25,15 @@
* *
*/ */
class <?php echo $model; ?>Fixture extends CakeTestFixture { class <?php echo $model; ?>Fixture extends CakeTestFixture {

<?php if ($table): ?> <?php if ($table): ?>
/** /**
* Table name * Table name
* *
* @var string * @var string
*/ */
public $table = '<?php echo $table; ?>'; public $table = '<?php echo $table; ?>';

<?php endif; ?> <?php endif; ?>
<?php if ($import): ?> <?php if ($import): ?>
/** /**
Expand All @@ -40,23 +42,24 @@ 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
* *
* @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
* *
* @var array * @var array
*/ */
public $records = <?php echo $records; ?>; public $records = <?php echo $records; ?>;

<?php endif;?> <?php endif;?>
} }
6 changes: 5 additions & 1 deletion lib/Cake/Console/Templates/default/classes/model.ctp
Expand Up @@ -36,18 +36,20 @@ 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
* *
* @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'): ?>
/** /**
Expand All @@ -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): ?>
/** /**
Expand All @@ -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)):
Expand Down
7 changes: 6 additions & 1 deletion lib/Cake/Console/Templates/default/classes/test.ctp
Expand Up @@ -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
* *
Expand All @@ -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; ?>
/** /**
Expand Down Expand Up @@ -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;?>
} }

0 comments on commit d1f522e

Please sign in to comment.