Skip to content

Commit

Permalink
Updated descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
rougin committed Jan 8, 2016
1 parent 4c742c6 commit 1169501
Show file tree
Hide file tree
Showing 19 changed files with 127 additions and 86 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,19 @@
*/
abstract class AbstractCommand extends Command
{
/**
* @var \Rougin\Describe\Describe
*/
protected $describe;

/**
* @var \Twig_Environment
*/
protected $renderer;

/**
* @param Twig_Environment $renderer
* @param Describe $describe
* @param \Twig_Environment $renderer
* @param \Rougin\Describe\Describe $describe
*/
public function __construct(Describe $describe, Twig_Environment $renderer)
{
Expand Down
1 change: 0 additions & 1 deletion src/Commands/CreateControllerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Rougin\Combustor\Common\File;
use Rougin\Combustor\Common\Tools;
use Rougin\Combustor\Validator\Validator;
use Rougin\Combustor\Common\AbstractCommand;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
Expand Down
3 changes: 1 addition & 2 deletions src/Commands/CreateLayoutCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Rougin\Combustor\Commands;

use Rougin\Combustor\Common\Tools;
use Rougin\Combustor\Common\AbstractCommand;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
Expand Down Expand Up @@ -106,7 +105,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
array_push($data['scripts'], $bootstrapJs);
}

if ( ! @mkdir($filePath, 0777, TRUE)) {
if ( ! @mkdir($filePath, 0777, true)) {
$message = 'The layout directory already exists!';

return $output->writeln('<error>'.$message.'</error>');
Expand Down
1 change: 0 additions & 1 deletion src/Commands/CreateModelCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Rougin\Combustor\Common\File;
use Rougin\Combustor\Common\Tools;
use Rougin\Combustor\Validator\Validator;
use Rougin\Combustor\Common\AbstractCommand;
use Rougin\Combustor\Generator\ModelGenerator;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
Expand Down
1 change: 0 additions & 1 deletion src/Commands/CreateScaffoldCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Rougin\Combustor\Commands;

use Rougin\Combustor\Common\AbstractCommand;
use Rougin\Combustor\Common\Tools;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputArgument;
Expand Down
5 changes: 2 additions & 3 deletions src/Commands/CreateViewCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Rougin\Combustor\Common\File;
use Rougin\Combustor\Common\Tools;
use Rougin\Combustor\Common\FileCollection;
use Rougin\Combustor\Common\AbstractCommand;
use Rougin\Combustor\Generator\ViewGenerator;
use Rougin\Combustor\Validator\ViewValidator;
use Symfony\Component\Console\Command\Command;
Expand Down Expand Up @@ -36,10 +35,10 @@ class CreateViewCommand extends AbstractCommand
public function isEnabled()
{
if ( ! Tools::isCommandEnabled() && ! Tools::hasLayout()) {
return FALSE;
return false;
}

return TRUE;
return true;
}

/**
Expand Down
9 changes: 4 additions & 5 deletions src/Commands/InstallDoctrineCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Rougin\Combustor\Commands;

use Rougin\Combustor\Common\Tools;
use Rougin\Combustor\Common\AbstractCommand;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
Expand All @@ -30,10 +29,10 @@ class InstallDoctrineCommand extends AbstractCommand
public function isEnabled()
{
if (file_exists(APPPATH.'libraries/Doctrine.php')) {
return FALSE;
return false;
}

return TRUE;
return true;
}

/**
Expand Down Expand Up @@ -133,8 +132,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
$schemaTool = 'use Doctrine\ORM\Tools\SchemaTool;';
$coreModel = 'include BASEPATH . \'core/Model.php\';';

if (strpos($abstractCommand, $schemaTool) !== FALSE) {
if (strpos($abstractCommand, $coreModel) === FALSE) {
if (strpos($abstractCommand, $schemaTool) !== false) {
if (strpos($abstractCommand, $coreModel) === false) {
$contents = str_replace($search, $replace, $abstractCommand);
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/Commands/InstallWildfireCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Rougin\Combustor\Commands;

use Rougin\Combustor\Common\Tools;
use Rougin\Combustor\Common\AbstractCommand;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
Expand All @@ -30,10 +29,10 @@ class InstallWildfireCommand extends AbstractCommand
public function isEnabled()
{
if (file_exists(APPPATH.'libraries/Wildfire.php')) {
return FALSE;
return false;
}

return TRUE;
return true;
}

/**
Expand Down
1 change: 0 additions & 1 deletion src/Commands/RemoveDoctrineCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Rougin\Combustor\Commands;

use Rougin\Combustor\Common\Tools;
use Rougin\Combustor\Common\AbstractCommand;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
Expand Down
1 change: 0 additions & 1 deletion src/Commands/RemoveWildfireCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Rougin\Combustor\Commands;

use Rougin\Combustor\Common\Tools;
use Rougin\Combustor\Common\AbstractCommand;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
Expand Down
7 changes: 7 additions & 0 deletions src/Common/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@
*/
class File
{
/**
* @var File pointer
*/
protected $file;

/**
* @var string
*/
protected $path;

/**
Expand Down
9 changes: 6 additions & 3 deletions src/Common/FileCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
*/
class FileCollection
{
protected $files;
/**
* @var array
*/
protected $files = [];

/**
* Adds a File object to the listing of files.
Expand All @@ -38,11 +41,11 @@ public function close()
{
foreach ($this->files as $file) {
if ( ! $file->close()) {
return FALSE;
return false;
}
}

return TRUE;
return true;
}

/**
Expand Down
42 changes: 11 additions & 31 deletions src/Common/Tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,21 @@ public static function ignite()
$config = new File(APPPATH.'config/config.php', 'wb');

$search = [
'$config[\'composer_autoload\'] = FALSE;'
'$config[\'composer_autoload\'] = false;'
];

$replace = [
'$config[\'composer_autoload\'] = realpath(\'vendor\') . \'/autoload.php\';'
];

// Removes the index.php from $config['index_page'].
if (strpos($config->getContents(), '$config[\'index_page\'] = \'index.php\';') !== FALSE) {
if (strpos($config->getContents(), '$config[\'index_page\'] = \'index.php\';') !== false) {
array_push($search, '$config[\'index_page\'] = \'index.php\';');
array_push($replace, '$config[\'index_page\'] = \'\';');
}

// Adds an encryption key from the configuration.
if (strpos($config->getContents(), '$config[\'encryption_key\'] = \'\';') !== FALSE) {
if (strpos($config->getContents(), '$config[\'encryption_key\'] = \'\';') !== false) {
array_push($search, '$config[\'encryption_key\'] = \'\';');
array_push($replace, '$config[\'encryption_key\'] = \''.md5('rougin').'\';');
}
Expand Down Expand Up @@ -149,11 +149,7 @@ public static function ignite()
*/
public static function isCommandEnabled()
{
if ( ! self::isWildfireEnabled() && ! self::isDoctrineEnabled()) {
return FALSE;
}

return TRUE;
return self::isWildfireEnabled() || self::isDoctrineEnabled();
}

/**
Expand All @@ -163,11 +159,7 @@ public static function isCommandEnabled()
*/
public static function isDoctrineEnabled()
{
if ( ! file_exists(APPPATH.'libraries/Doctrine.php')) {
return FALSE;
}

return TRUE;
return file_exists(APPPATH.'libraries/Doctrine.php');
}

/**
Expand All @@ -177,14 +169,8 @@ public static function isDoctrineEnabled()
*/
public static function hasLayout()
{
if (
! file_exists(APPPATH.'views/layout/header.php') ||
! file_exists(APPPATH.'views/layout/footer.php')
) {
return FALSE;
}

return TRUE;
return file_exists(APPPATH.'views/layout/header.php')
&& file_exists(APPPATH.'views/layout/footer.php');
}

/**
Expand All @@ -194,11 +180,7 @@ public static function hasLayout()
*/
public static function isWildfireEnabled()
{
if ( ! file_exists(APPPATH.'libraries/Wildfire.php')) {
return FALSE;
}

return TRUE;
return file_exists(APPPATH.'libraries/Wildfire.php');
}

/**
Expand All @@ -209,11 +191,9 @@ public static function isWildfireEnabled()
*/
public static function stripTableSchema($table)
{
if (strpos($table, '.') !== FALSE) {
return substr($table, strpos($table, '.') + 1);
}

return $table;
return (strpos($table, '.') !== false)
? substr($table, strpos($table, '.') + 1)
: $table;
}

/**
Expand Down
15 changes: 11 additions & 4 deletions src/Generator/ControllerGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,19 @@
*/
class ControllerGenerator implements GeneratorInterface
{
/**
* @var \Rougin\Describe\Describe
*/
protected $describe;
protected $data;

/**
* @param Describe $describe
* @param array $data
* @var array
*/
protected $data = [];

/**
* @param \Rougin\Describe\Describe $describe
* @param array $data
*/
public function __construct(Describe $describe, array $data)
{
Expand Down Expand Up @@ -100,4 +107,4 @@ public function generate()

return $this->data;
}
}
}
2 changes: 1 addition & 1 deletion src/Generator/GeneratorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ interface GeneratorInterface
* @return array
*/
public function generate();
}
}
15 changes: 11 additions & 4 deletions src/Generator/ModelGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,19 @@
*/
class ModelGenerator implements GeneratorInterface
{
/**
* @var \Rougin\Describe\Describe
*/
protected $describe;
protected $data;

/**
* @param Describe $describe
* @param array $data
* @var array
*/
protected $data = [];

/**
* @param \Rougin\Describe\Describe $describe
* @param array $data
*/
public function __construct(Describe $describe, array $data)
{
Expand Down Expand Up @@ -96,4 +103,4 @@ public function generate()

return $this->data;
}
}
}
15 changes: 11 additions & 4 deletions src/Generator/ViewGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,19 @@
*/
class ViewGenerator implements GeneratorInterface
{
/**
* @var \Rougin\Describe\Describe
*/
protected $describe;
protected $data;

/**
* @param Describe $describe
* @param array $data
* @var array
*/
protected $data = [];

/**
* @param \Rougin\Describe\Describe $describe
* @param array $data
*/
public function __construct(Describe $describe, array $data)
{
Expand Down Expand Up @@ -139,4 +146,4 @@ public function generate()

return $this->data;
}
}
}
Loading

0 comments on commit 1169501

Please sign in to comment.