refactoring
This commit is contained in:
parent
7380f7302c
commit
57be1c0b39
|
@ -95,7 +95,7 @@ if (\$this->isColumnModified($const) && \$this->{$this->getColumnGetter()}()) {
|
|||
foreach ($matches[1] as $key => $match) {
|
||||
|
||||
$column = $this->getTable()->getColumn($this->underscore(ucfirst($match)));
|
||||
if (null == $column) {
|
||||
if (empty($column)) {
|
||||
throw new \InvalidArgumentException(sprintf('The pattern %s is invalid the column %s is not found', $pattern, $match));
|
||||
}
|
||||
$columnConst = $builder->getColumnConstant($column);
|
||||
|
@ -106,7 +106,7 @@ if (\$this->isColumnModified($const) && \$this->{$this->getColumnGetter()}()) {
|
|||
\$this->{$this->getColumnSetter()}(\$this->createSlug());";
|
||||
}
|
||||
|
||||
if (null == $pattern && false === $this->booleanValue($this->getParameter('permanent'))) {
|
||||
if (empty($pattern) && false === $this->booleanValue($this->getParameter('permanent'))) {
|
||||
$script .= "
|
||||
} else {
|
||||
\$this->{$this->getColumnSetter()}(\$this->createSlug());
|
||||
|
@ -315,7 +315,7 @@ protected function makeSlugUnique(\$slug, \$separator = '" . $this->getParameter
|
|||
} else {
|
||||
\$slug2 = \$slug . \$separator;";
|
||||
|
||||
if (null == $this->getParameter('slug_pattern')) {
|
||||
if (null === $this->getParameter('slug_pattern')) {
|
||||
$script .= "
|
||||
|
||||
\$count = " . $this->builder->getStubQueryBuilder()->getClassname() . "::create()
|
||||
|
@ -323,7 +323,7 @@ protected function makeSlugUnique(\$slug, \$separator = '" . $this->getParameter
|
|||
->filterByPrimaryKey(\$this->getPrimaryKey())
|
||||
->count();
|
||||
|
||||
if (1 == \$count) {
|
||||
if (1 === \$count) {
|
||||
return \$this->$getter();
|
||||
}";
|
||||
}
|
||||
|
@ -364,12 +364,12 @@ protected function makeSlugUnique(\$slug, \$separator = '" . $this->getParameter
|
|||
->findOne();
|
||||
|
||||
// First duplicate slug
|
||||
if (null == \$object) {
|
||||
if (null === \$object) {
|
||||
return \$slug2 . '1';
|
||||
}
|
||||
|
||||
\$slugNum = substr(\$object->" . $getter . "(), strlen(\$slug) + 1);
|
||||
if (0 == \$slugNum[0]) {
|
||||
if (0 === \$slugNum[0]) {
|
||||
\$slugNum[0] = 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue