jamband\schemadump\SchemaDumpController::getPrimaryKeyDefinition PHP Method

getPrimaryKeyDefinition() private method

Returns the primary key definition.
private getPrimaryKeyDefinition ( array $pk, string $stdout, integer $offset ) : string | null
$pk array
$stdout string
$offset integer
return string | null the primary key definition or null
    private function getPrimaryKeyDefinition($pk, $stdout, $offset)
    {
        if (!empty($pk)) {
            // Composite primary keys
            if (count($pk) >= 2) {
                $compositePk = implode(', ', $pk);
                return "    'PRIMARY KEY ({$compositePk})',\n";
            }
            // Primary key not an auto-increment
            if (false === strpos($stdout, $this->type('pk'), $offset) && false === strpos($stdout, $this->type('bigpk'), $offset)) {
                return "    'PRIMARY KEY ({$pk[0]})',\n";
            }
        }
    }