Skip to content

Commit

Permalink
* #hot-fix. clean up duplications, ConfigTrait->abstract setTabs()
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurkushman committed May 28, 2017
1 parent 2b3d02a commit 1952519
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 42 deletions.
45 changes: 3 additions & 42 deletions src/blocks/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,48 +52,6 @@ public function create()
}
}

/**
* @param string $entity
*/
private function setTable(string $entity)
{
$this->setTabs(2);
$this->sourceCode .= PhpInterface::QUOTES . ModelsInterface::MIGRATION_TABLE . PhpInterface::QUOTES
. PhpInterface::SPACE . PhpInterface::DOUBLE_ARROW
. PhpInterface::SPACE . PhpInterface::QUOTES . MigrationsHelper::getTableName($entity)
. PhpInterface::QUOTES . PhpInterface::COMMA . PHP_EOL;
}

private function setEnabled()
{
$this->setTabs(2);
$this->sourceCode .= PhpInterface::QUOTES . ConfigInterface::ENABLED . PhpInterface::QUOTES
. PhpInterface::SPACE . PhpInterface::DOUBLE_ARROW .
PhpInterface::SPACE . PhpInterface::PHP_TYPES_BOOL_TRUE . PhpInterface::COMMA . PHP_EOL;
}

/**
* @param int $time
*/
private function setActivate(int $time)
{
$this->setTabs(2);
$this->sourceCode .= PhpInterface::QUOTES . ConfigInterface::ACTIVATE . PhpInterface::QUOTES
. PhpInterface::SPACE . PhpInterface::DOUBLE_ARROW .
PhpInterface::SPACE . $time . PhpInterface::COMMA . PHP_EOL;
}

/**
* @param int $time
*/
private function setExpires(int $time)
{
$this->setTabs(2);
$this->sourceCode .= PhpInterface::QUOTES . ConfigInterface::EXPIRES . PhpInterface::QUOTES
. PhpInterface::SPACE . PhpInterface::DOUBLE_ARROW .
PhpInterface::SPACE . $time . PhpInterface::COMMA . PHP_EOL;
}

/**
* Constructs the config structure
*/
Expand Down Expand Up @@ -221,6 +179,9 @@ private function setSpellCheck()
$this->closeEntity();
}

/**
* @param string $objName
*/
private function setSpellOptions(string $objName)
{
if(empty($this->generator->types[$objName . CustomsInterface::CUSTOM_TYPES_ATTRIBUTES][RamlInterface::RAML_PROPS]) === false) {
Expand Down
6 changes: 6 additions & 0 deletions src/blocks/ConfigTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ private function openSpellCheck()
. PhpInterface::OPEN_BRACKET . PHP_EOL;
}

/**
* @param int $amount
* @return mixed
*/
protected abstract function setTabs(int $amount = 1);

/**
* Opens finite state machine
* @param string $entity
Expand Down

0 comments on commit 1952519

Please sign in to comment.