From 4c742c629a7a7738adca560145d87f5e3e59049b Mon Sep 17 00:00:00 2001 From: Rougin Royce Gutib Date: Tue, 1 Dec 2015 21:59:17 +0800 Subject: [PATCH] Added fixes to issues that are raised by Scrutinizer --- src/Common/AbstractCommand.php | 2 +- src/Common/File.php | 2 +- src/Generator/ModelGenerator.php | 24 +++++++++++------------- src/Generator/ViewGenerator.php | 24 +++++++++++------------- 4 files changed, 24 insertions(+), 28 deletions(-) diff --git a/src/Common/AbstractCommand.php b/src/Common/AbstractCommand.php index ec64335..2a4604f 100644 --- a/src/Common/AbstractCommand.php +++ b/src/Common/AbstractCommand.php @@ -2,9 +2,9 @@ namespace Rougin\Combustor\Common; +use Twig_Environment; use Rougin\Describe\Describe; use Symfony\Component\Console\Command\Command; -use Twig_Environment; /** * Abstract Command diff --git a/src/Common/File.php b/src/Common/File.php index 4ad4bab..063318a 100644 --- a/src/Common/File.php +++ b/src/Common/File.php @@ -62,7 +62,7 @@ public function putContents($content) * @param integer $mode * @return boolean */ - public function chmod(int $mode) + public function chmod($mode) { return chmod($this->path, $mode); } diff --git a/src/Generator/ModelGenerator.php b/src/Generator/ModelGenerator.php index 386389e..d3f37ed 100644 --- a/src/Generator/ModelGenerator.php +++ b/src/Generator/ModelGenerator.php @@ -60,19 +60,17 @@ public function generate() $accessor = 'get_'.$field; $mutator = 'set_'.$field; - if ($this->data['isCamel']) { - $this->data['camel'][$field] = array( - 'field' => lcfirst(camelize($field)), - 'accessor' => lcfirst(camelize($accessor)), - 'mutator' => lcfirst(camelize($mutator)) - ); - } else { - $this->data['underscore'][$field] = array( - 'field' => lcfirst(underscore($field)), - 'accessor' => lcfirst(underscore($accessor)), - 'mutator' => lcfirst(underscore($mutator)) - ); - } + $this->data['camel'][$field] = [ + 'field' => lcfirst(camelize($field)), + 'accessor' => lcfirst(camelize($accessor)), + 'mutator' => lcfirst(camelize($mutator)) + ]; + + $this->data['underscore'][$field] = [ + 'field' => lcfirst(underscore($field)), + 'accessor' => lcfirst(underscore($accessor)), + 'mutator' => lcfirst(underscore($mutator)) + ]; if ($column->isForeignKey()) { $field = $column->getField(); diff --git a/src/Generator/ViewGenerator.php b/src/Generator/ViewGenerator.php index d0e4b39..ed6e6ca 100644 --- a/src/Generator/ViewGenerator.php +++ b/src/Generator/ViewGenerator.php @@ -99,19 +99,17 @@ public function generate() $accessor = 'get_'.$field; $mutator = 'set_'.$field; - if ($this->data['isCamel']) { - $this->data['camel'][$field] = array( - 'field' => lcfirst(camelize($field)), - 'accessor' => lcfirst(camelize($accessor)), - 'mutator' => lcfirst(camelize($mutator)) - ); - } else { - $this->data['underscore'][$field] = array( - 'field' => lcfirst(underscore($field)), - 'accessor' => lcfirst(underscore($accessor)), - 'mutator' => lcfirst(underscore($mutator)) - ); - } + $this->data['camel'][$field] = [ + 'field' => lcfirst(camelize($field)), + 'accessor' => lcfirst(camelize($accessor)), + 'mutator' => lcfirst(camelize($mutator)) + ]; + + $this->data['underscore'][$field] = [ + 'field' => lcfirst(underscore($field)), + 'accessor' => lcfirst(underscore($accessor)), + 'mutator' => lcfirst(underscore($mutator)) + ]; if ($column->isForeignKey()) { $referencedTable = Tools::stripTableSchema(