Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

friendsofphp is preferred to use for php-cs-fixer #39

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
/vendor
/build
/.idea
/.vagrant
.DS_Store
Homestead.json
Homestead.yaml
composer.lock
*.cache
77 changes: 0 additions & 77 deletions .php_cs

This file was deleted.

6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
"illuminate/database": "^5.2",
"illuminate/events": "^5.2",
"illuminate/filesystem": "^5.2",
"illuminate/support": "^5.2"
"illuminate/support": "^5.2",
"friendsofphp/php-cs-fixer": "^2.7"
},
"require-dev": {
"phpunit/phpunit": "4.*",
"mockery/mockery": "~0.9",
"d11wtq/boris": "~1.0.10",
"satooshi/php-coveralls": "dev-master",
"fabpot/php-cs-fixer": "^1.11"
"satooshi/php-coveralls": "dev-master"
},
"autoload": {
"psr-0": {
Expand Down
66 changes: 66 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0"?>
<ruleset name="MCMScs">

<description>
Macellan Coding Standard for Illuminate 55.x
</description>

<exclude-pattern>vendor/*</exclude-pattern>

<!-- Generic -->
<rule ref="Generic.Files.LineLength.TooLong">
<exclude-pattern>tests/*</exclude-pattern>
</rule>

<!-- PSR1 -->
<rule ref="PSR1">

</rule>
<rule ref="PSR1.Classes.ClassDeclaration.MissingNamespace">
<exclude-pattern>tests/*</exclude-pattern>
</rule>
<rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses">
<exclude-pattern>tests/*</exclude-pattern>
</rule>

<!-- PSR2 -->
<rule ref="PSR2">
<exclude name="PSR2.Classes.PropertyDeclaration.Underscore" />
</rule>

<!-- Squiz -->
<rule ref="Squiz.Strings">
<exclude name="Squiz.Strings.DoubleQuoteUsage.ContainsVar" />
</rule>
<rule ref="Squiz.Strings.ConcatenationSpacing">
<properties>
<property name="ignoreNewlines" value="true" />
</properties>
</rule>

<rule ref="Squiz.WhiteSpace">
<exclude name="Squiz.WhiteSpace.FunctionClosingBraceSpace.SpacingBeforeClose" />
<exclude name="Squiz.WhiteSpace.MemberVarSpacing.Incorrect" />
</rule>
<rule ref="Squiz.WhiteSpace.FunctionSpacing">
<exclude name="Squiz.WhiteSpace.FunctionSpacing.Before"/>
<exclude name="Squiz.WhiteSpace.FunctionSpacing.After"/>
<properties>
<property name="spacing" value="1" />
</properties>
</rule>
<rule ref="Squiz.WhiteSpace.ObjectOperatorSpacing">
<properties>
<property name="ignoreNewlines" value="true" />
</properties>
</rule>
<rule ref="Squiz.WhiteSpace.OperatorSpacing">
<properties>
<property name="ignoreNewlines" value="true" />
</properties>
</rule>

<!-- Pear -->
<rule ref="PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket" />
<rule ref="PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket" />
</ruleset>
17 changes: 9 additions & 8 deletions src/Baum/Console/BaumCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,30 @@

class BaumCommand extends Command
{

/**
* The console command name.
*
* @var string
*/
protected $name = 'baum';
protected $name = 'baum';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Get Baum version notice.';
protected $description = 'Get Baum version notice.';

/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
$this->line('<info>Baum</info> version <comment>'.Baum::VERSION.'</comment>');
$this->line('A Nested Set pattern implementation for the Eloquent ORM.');
$this->line('<comment>Copyright (c) 2013 Estanislau Trepat</comment>');
}
public function fire()
{
$this->line('<info>Baum</info> version <comment>'.Baum::VERSION.'</comment>');
$this->line('A Nested Set pattern implementation for the Eloquent ORM.');
$this->line('<comment>Copyright (c) 2013 Estanislau Trepat</comment>');
}
}
91 changes: 46 additions & 45 deletions src/Baum/Console/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,46 +9,47 @@

class InstallCommand extends Command
{

/**
* The console command name.
*
* @var string
*/
protected $name = 'baum:install';
protected $name = 'baum:install';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Scaffolds a new migration and model suitable for Baum.';
protected $description = 'Scaffolds a new migration and model suitable for Baum.';

/**
* Migration generator instance.
*
* @var Baum\Generators\MigrationGenerator
* @var \Baum\Generators\MigrationGenerator
*/
protected $migrator;
protected $migrator;

/**
* Model generator instance.
*
* @var Baum\Generators\ModelGenerator
* @var \Baum\Generators\ModelGenerator
*/
protected $modeler;
protected $modeler;

/**
* Create a new command instance.
*
* @return void
*/
public function __construct(MigrationGenerator $migrator, ModelGenerator $modeler)
{
parent::__construct();
public function __construct(MigrationGenerator $migrator, ModelGenerator $modeler)
{
parent::__construct();

$this->migrator = $migrator;
$this->modeler = $modeler;
}
$this->migrator = $migrator;
$this->modeler = $modeler;
}

/**
* Execute the console command.
Expand All @@ -60,68 +61,68 @@ public function __construct(MigrationGenerator $migrator, ModelGenerator $modele
*
* @return void
*/
public function fire()
{
$name = $this->input->getArgument('name');
$this->writeMigration($name);
$this->writeModel($name);
}
public function fire()
{
$name = $this->input->getArgument('name');
$this->writeMigration($name);
$this->writeModel($name);
}

/**
* Get the command arguments.
*
* @return array
*/
protected function getArguments()
{
return [
protected function getArguments()
{
return [
['name', InputArgument::REQUIRED, 'Name to use for the scaffolding of the migration and model.'],
];
}
];
}

/**
* Write the migration file to disk.
*
* @param string $name
* @param string $name
*
* @return string
* @return void
*/
protected function writeMigration($name)
{
$output = pathinfo($this->migrator->create($name, $this->getMigrationsPath()), PATHINFO_FILENAME);
$this->line(" <fg=green;options=bold>create</fg=green;options=bold> $output");
}
protected function writeMigration($name)
{
$output = pathinfo($this->migrator->create($name, $this->getMigrationsPath()), PATHINFO_FILENAME);
$this->line(" <fg=green;options=bold>create</fg=green;options=bold> $output");
}

/**
* Write the model file to disk.
*
* @param string $name
* @param string $name
*
* @return string
* @return void
*/
protected function writeModel($name)
{
$output = pathinfo($this->modeler->create($name, $this->getModelsPath()), PATHINFO_FILENAME);
$this->line(" <fg=green;options=bold>create</fg=green;options=bold> $output");
}
protected function writeModel($name)
{
$output = pathinfo($this->modeler->create($name, $this->getModelsPath()), PATHINFO_FILENAME);
$this->line(" <fg=green;options=bold>create</fg=green;options=bold> $output");
}

/**
* Get the path to the migrations directory.
*
* @return string
*/
protected function getMigrationsPath()
{
return $this->laravel->databasePath();
}
protected function getMigrationsPath()
{
return $this->laravel->databasePath();
}

/**
* Get the path to the models directory.
*
* @return string
*/
protected function getModelsPath()
{
return $this->laravel->basePath();
}
protected function getModelsPath()
{
return $this->laravel->basePath();
}
}
Loading