for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace yentu\database;
abstract class BasicKey extends DatabaseItem implements Commitable, Changeable, Initializable
{
protected $columns;
protected $table;
protected $name;
public function __construct($columns, $table)
$this->columns = $columns;
$this->table = $table;
}
#[\Override]
public function initialize(): void
$keyName = $this->doesKeyExist(array(
'table' => $this->table->getName(),
'schema' => $this->table->getSchema()->getName(),
'columns' => $this->columns)
);
if($keyName === false)
$this->new = true;
$this->name = $this->table->getName() . '_' . implode('_', $this->columns) . '_' . $this->getNamePostfix();
else
$this->name = $keyName;
abstract protected function doesKeyExist($constraint);
abstract protected function addKey($constraint);
abstract protected function dropKey($constraint);
abstract protected function getNamePostfix();
public function buildDescription()
return array(
'columns' => $this->columns,
'name' => $this->name
public function commitNew()
$this->addKey($this->buildDescription());
public function drop()
$this->dropKey($this->getKeyDescription());
getKeyDescription()
yentu\database\BasicKey
__call
If this is a false-positive, you can also ignore this issue in your code via the ignore-call annotation
ignore-call
$this->dropKey($this->/** @scrutinizer ignore-call */ getKeyDescription());
return $this;
public function name($name)
$this->name = $name;