Skip to content

Commit

Permalink
Merge pull request #5 from shopwareLabs/use-array-short-sytax-everywhere
Browse files Browse the repository at this point in the history
fixup style & comments
  • Loading branch information
JanPietrzyk authored Jul 24, 2017
2 parents 88816b4 + fdf6999 commit c1e3e6e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
18 changes: 9 additions & 9 deletions src/NestedSetTableFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ public function createTable(Schema $schema, string $tableName, string $rootColum

$treeTable = $schema->createTable($this->connection->quoteIdentifier($tableName));

$treeTable->addColumn($this->leftCol, 'integer', array('unsigned' => true));
$treeTable->addColumn($this->rightCol, 'integer', array('unsigned' => true));
$treeTable->addColumn($this->levelCol, 'integer', array('unsigned' => true));
$treeTable->addColumn($this->rootCol, 'integer', array('unsigned' => true));

$treeTable->addIndex(array($this->leftCol))
->addIndex(array($this->rightCol))
->addIndex(array($this->levelCol))
->addIndex(array($this->rootCol));
$treeTable->addColumn($this->leftCol, 'integer', ['unsigned' => true]);
$treeTable->addColumn($this->rightCol, 'integer', ['unsigned' => true]);
$treeTable->addColumn($this->levelCol, 'integer', ['unsigned' => true]);
$treeTable->addColumn($this->rootCol, 'integer', ['unsigned' => true]);

$treeTable->addIndex([$this->leftCol])
->addIndex([$this->rightCol])
->addIndex([$this->levelCol])
->addIndex([$this->rootCol]);

return $treeTable;
}
Expand Down
13 changes: 4 additions & 9 deletions src/NestedSetWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function insertRoot(string $tableExpression, string $rootColumnName, int
* @param array $types
* @return int id of the new node
*/
public function insertAsFirstChild(string $tableExpression, string $rootColumnName, int $parentId, array $data, array $types = array()): int
public function insertAsFirstChild(string $tableExpression, string $rootColumnName, int $parentId, array $data, array $types = []): int
{
$this->setRootColName($rootColumnName, $this->connection);
$parentData = $this->reader->fetchNodeData($tableExpression, $rootColumnName, $parentId);
Expand Down Expand Up @@ -109,7 +109,7 @@ public function insertAsFirstChild(string $tableExpression, string $rootColumnNa
* @param array $types
* @return int id of the new node
*/
public function insertAsLastChild(string $tableExpression, string $rootColumnName, int $parentId, array $data, array $types = array()): int
public function insertAsLastChild(string $tableExpression, string $rootColumnName, int $parentId, array $data, array $types = []): int
{
$this->setRootColName($rootColumnName, $this->connection);
$parentData = $this->reader->fetchNodeData($tableExpression, $rootColumnName, $parentId);
Expand Down Expand Up @@ -137,7 +137,7 @@ public function insertAsLastChild(string $tableExpression, string $rootColumnNam
* @param array $types
* @return int
*/
public function insertAsPrevSibling(string $tableExpression, string $rootColumnName, int $siblingId, array $data, array $types = array()): int
public function insertAsPrevSibling(string $tableExpression, string $rootColumnName, int $siblingId, array $data, array $types = []): int
{
$this->setRootColName($rootColumnName, $this->connection);
$childData = $this->reader->fetchNodeData($tableExpression, $rootColumnName, $siblingId);
Expand Down Expand Up @@ -165,7 +165,7 @@ public function insertAsPrevSibling(string $tableExpression, string $rootColumnN
* @param array $types
* @return int
*/
public function insertAsNextSibling(string $tableExpression, string $rootColumnName, int $siblingId, array $data, array $types = array()): int
public function insertAsNextSibling(string $tableExpression, string $rootColumnName, int $siblingId, array $data, array $types = []): int
{
$this->setRootColName($rootColumnName, $this->connection);
$childData = $this->reader->fetchNodeData($tableExpression, $rootColumnName, $siblingId);
Expand Down Expand Up @@ -394,8 +394,6 @@ private function updateNodePosition(string $tableExpression, array $nodeData, $d
/**
* adds '$delta' to all Left and Right values that are >= '$first'. '$delta' can also be negative.
*
* Note: This method does wrap its database queries in a transaction. This should be done
* by the invoking code.
*
* @param string $tableExpression
* @param int $rootValue
Expand Down Expand Up @@ -433,9 +431,6 @@ private function applyDeltaToSubsequendNodes(string $tableExpression, int $rootV
* adds '$delta' to all Left and Right values that are >= '$first' and <= '$last'.
* '$delta' can also be negative.
*
* Note: This method does wrap its database queries in a transaction. This should be done
* by the invoking code.
*
* @param string $tableExpression
* @param int $rootValue
* @param int $first First node to be shifted (L value)
Expand Down

0 comments on commit c1e3e6e

Please sign in to comment.