diff --git a/README.md b/README.md index 3539b9b..101a700 100644 --- a/README.md +++ b/README.md @@ -20,13 +20,13 @@ The way each implementation stores data is NOT guaranteed to be compatible, plea Requires the `redis` extension. Valkey is the name of the Linux Foundation's fork of Redis. -### `Index\Data\MariaDB` +### `Index\Data\MariaDb` Requires the `mysqli` extension. `mysqlnd` is recommended as the underlying driver, but `libmysql` should work without a hitch. This driver also works for MySQL as the dependencies would suggest, but you should consider using MariaDB instead of possible. -### `Index\Data\SQLite` +### `Index\Data\Sqlite` Requires the `sqlite3` extension. @@ -36,7 +36,7 @@ Requires the `sqlite3` extension. Index versioning will mostly follow the [Semantic Versioning specification v2.0.0](https://semver.org/spec/v2.0.0.html), counting dropped support for a minor PHP version (e.g. 7.1 -> 7.2 or 7.4 -> 8.0) as a reason to increment the major version. Previous major versions may be supported for a time with backports depending on what projects of mine still target older versions of PHP. -The version is stored in the root of the repository in a file called `VERSION` and can be read out within Index using `Index\Environment::getIndexVersion()`. +The version is stored in the root of the repository in a file called `VERSION` and can be read out within Index using `Index\Index::version()`. ## Contribution diff --git a/VERSION b/VERSION index 4979880..a43af74 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.2408.611934 +0.2410.20133 diff --git a/composer.json b/composer.json index 9ccd859..c802ab5 100644 --- a/composer.json +++ b/composer.json @@ -13,8 +13,8 @@ "phpstan/phpstan": "^1.11" }, "suggest": { - "ext-mysqli": "Support for the Index\\Data\\MariaDB namespace (both mysqlnd and libmysql are supported).", - "ext-sqlite3": "Support for the Index\\Data\\SQLite namespace." + "ext-mysqli": "Support for the Index\\Data\\MariaDb namespace (both mysqlnd and libmysql are supported).", + "ext-sqlite3": "Support for the Index\\Data\\Sqlite namespace." }, "authors": [ { diff --git a/src/Bencode/Bencode.php b/src/Bencode/Bencode.php index d1cdfc4..edd12eb 100644 --- a/src/Bencode/Bencode.php +++ b/src/Bencode/Bencode.php @@ -1,13 +1,13 @@ getHost(); $port = $endPointInfo[0]->getPort(); - } elseif($endPointInfo[0] instanceof IPEndPoint) { + } elseif($endPointInfo[0] instanceof IpEndPoint) { $host = $endPointInfo[0]->getAddress()->getCleanAddress(); $port = $endPointInfo[0]->getPort(); } else throw new InvalidArgumentException('One of the servers specified in $providerInfo is not a supported endpoint.'); diff --git a/src/Cache/Memcached/MemcachedProviderModern.php b/src/Cache/Memcached/MemcachedProviderModern.php index bcb6e10..91ae74d 100644 --- a/src/Cache/Memcached/MemcachedProviderModern.php +++ b/src/Cache/Memcached/MemcachedProviderModern.php @@ -1,14 +1,14 @@ getHost(); $port = $endPointInfo[0]->getPort(); - } elseif($endPointInfo[0] instanceof IPEndPoint) { + } elseif($endPointInfo[0] instanceof IpEndPoint) { $host = $endPointInfo[0]->getAddress()->getCleanAddress(); $port = $endPointInfo[0]->getPort(); } else throw new InvalidArgumentException('One of the servers specified in $providerInfo is not a supported endpoint.'); diff --git a/src/Cache/Valkey/ValkeyProvider.php b/src/Cache/Valkey/ValkeyProvider.php index 6912cfa..9129bf9 100644 --- a/src/Cache/Valkey/ValkeyProvider.php +++ b/src/Cache/Valkey/ValkeyProvider.php @@ -1,14 +1,14 @@ endPoint->getPath(); if($this->endPoint instanceof DnsEndPoint) return $this->endPoint->getHost(); - if($this->endPoint instanceof IPEndPoint) + if($this->endPoint instanceof IpEndPoint) return $this->endPoint->getAddress()->getCleanAddress(); throw new RuntimeException('EndPoint type is not supported.'); @@ -55,7 +55,7 @@ class ValkeyProviderInfo implements ICacheProviderInfo { * @return int */ public function getServerPort(): int { - if($this->endPoint instanceof DnsEndPoint || $this->endPoint instanceof IPEndPoint) + if($this->endPoint instanceof DnsEndPoint || $this->endPoint instanceof IpEndPoint) return $this->endPoint->getPort(); return 0; diff --git a/src/Colour/Colour.php b/src/Colour/Colour.php index 1cd2059..580e131 100644 --- a/src/Colour/Colour.php +++ b/src/Colour/Colour.php @@ -1,7 +1,7 @@ shouldInherit() || $colour2->shouldInherit()) return self::none(); - return new ColourRGB( + return new ColourRgb( (int)round(XNumber::weighted($colour2->getRed(), $colour1->getRed(), $weight)), (int)round(XNumber::weighted($colour2->getGreen(), $colour1->getGreen(), $weight)), (int)round(XNumber::weighted($colour2->getBlue(), $colour1->getBlue(), $weight)), @@ -136,7 +136,7 @@ abstract class Colour implements Stringable { * Creates a Colour object from raw Misuzu format. * * If bit 31 is set the global instance of ColourNull will always be returned, - * otherwise an instance of ColourRGB will be created using the fromRawRGB method (top 8 bits ignored). + * otherwise an instance of ColourRgb will be created using the fromRawRgb method (top 8 bits ignored). * * @param int $raw Raw RGB colour in Misuzu format. * @return Colour Colour instance representing the Misuzu colour. @@ -144,7 +144,7 @@ abstract class Colour implements Stringable { public static function fromMisuzu(int $raw): Colour { if($raw & self::MSZ_INHERIT) return self::$none; - return ColourRGB::fromRawRGB($raw); + return ColourRgb::fromRawRgb($raw); } /** @@ -194,9 +194,9 @@ abstract class Colour implements Stringable { } if($length === 6) - return ColourRGB::fromRawRGB((int)hexdec($value)); + return ColourRgb::fromRawRgb((int)hexdec($value)); if($length === 8) - return ColourRGB::fromRawRGBA((int)hexdec($value)); + return ColourRgb::fromRawRgba((int)hexdec($value)); } return self::$none; @@ -231,7 +231,7 @@ abstract class Colour implements Stringable { ]; } - return new ColourRGB(...$value); + return new ColourRgb(...$value); } if(str_starts_with($value, 'hsl(') || str_starts_with($value, 'hsla(')) { @@ -297,7 +297,7 @@ abstract class Colour implements Stringable { $alpha = (float)trim($alpha ?? '1'); } - return new ColourHSL($hue, $saturation, $lightness, $alpha); + return new ColourHsl($hue, $saturation, $lightness, $alpha); } return self::$none; diff --git a/src/Colour/ColourHSL.php b/src/Colour/ColourHsl.php similarity index 92% rename from src/Colour/ColourHSL.php rename to src/Colour/ColourHsl.php index 365231f..59974a6 100644 --- a/src/Colour/ColourHSL.php +++ b/src/Colour/ColourHsl.php @@ -1,14 +1,14 @@ getRed() / 255.0; @@ -155,7 +155,7 @@ class ColourHSL extends Colour { } } - return new ColourHSL( + return new ColourHsl( round($h, 3), round($s, 3), round($l, 3), diff --git a/src/Colour/ColourRGB.php b/src/Colour/ColourRgb.php similarity index 71% rename from src/Colour/ColourRGB.php rename to src/Colour/ColourRgb.php index c480cac..64dbcf7 100644 --- a/src/Colour/ColourRGB.php +++ b/src/Colour/ColourRgb.php @@ -1,14 +1,14 @@ > 16) & 0xFF), (($raw >> 8) & 0xFF), ($raw & 0xFF), @@ -71,13 +71,13 @@ class ColourRGB extends Colour { } /** - * Create a ColourRGB instance from a raw ARGB value. + * Create a ColourRgb instance from a raw ARGB value. * * @param int $raw A raw ARGB colour in 0xAARRGGBB format. - * @return ColourRGB An instance of ColourRGB. + * @return ColourRgb An instance of ColourRgb. */ - public static function fromRawARGB(int $raw): ColourRGB { - return new ColourRGB( + public static function fromRawArgb(int $raw): ColourRgb { + return new ColourRgb( (($raw >> 16) & 0xFF), (($raw >> 8) & 0xFF), ($raw & 0xFF), @@ -86,13 +86,13 @@ class ColourRGB extends Colour { } /** - * Create a ColourRGB instance from a raw RGBA value. + * Create a ColourRgb instance from a raw RGBA value. * * @param int $raw A raw RGBA colour in 0xRRGGBBAA format. - * @return ColourRGB An instance of ColourRGB. + * @return ColourRgb An instance of ColourRgb. */ - public static function fromRawRGBA(int $raw): ColourRGB { - return new ColourRGB( + public static function fromRawRgba(int $raw): ColourRgb { + return new ColourRgb( (($raw >> 24) & 0xFF), (($raw >> 16) & 0xFF), (($raw >> 8) & 0xFF), @@ -101,15 +101,15 @@ class ColourRGB extends Colour { } /** - * Converts any other colour to a ColourRGB. + * Converts any other colour to a ColourRgb. * * @param Colour $colour Original colour. - * @return ColourRGB Converted colour. + * @return ColourRgb Converted colour. */ - public static function convert(Colour $colour): ColourRGB { - if($colour instanceof ColourRGB) + public static function convert(Colour $colour): ColourRgb { + if($colour instanceof ColourRgb) return $colour; - return new ColourRGB( + return new ColourRgb( $colour->getRed(), $colour->getGreen(), $colour->getBlue(), diff --git a/src/CSRFP.php b/src/CsrfToken.php similarity index 96% rename from src/CSRFP.php rename to src/CsrfToken.php index a071677..c1ad6a4 100644 --- a/src/CSRFP.php +++ b/src/CsrfToken.php @@ -1,7 +1,7 @@ NullDb\NullDbBackend::class, - 'mariadb' => MariaDB\MariaDBBackend::class, - 'mysql' => MariaDB\MariaDBBackend::class, - 'sqlite' => SQLite\SQLiteBackend::class, - 'sqlite3' => SQLite\SQLiteBackend::class, + 'mariadb' => MariaDb\MariaDbBackend::class, + 'mysql' => MariaDb\MariaDbBackend::class, + 'sqlite' => Sqlite\SqliteBackend::class, + 'sqlite3' => Sqlite\SqliteBackend::class, ]; /** @return array */ diff --git a/src/Data/IDbResult.php b/src/Data/IDbResult.php index 012b25b..e2c8c45 100644 --- a/src/Data/IDbResult.php +++ b/src/Data/IDbResult.php @@ -1,12 +1,12 @@ `: Enabled verification of server certificate. Replaced with `enc_no_verify` as it now defaults to on. * * @param string|array $dsn DSN with connection information. - * @return MariaDBConnectionInfo MariaDB connection info. + * @return MariaDbConnectionInfo MariaDB connection info. */ public function parseDsn(string|array $dsn): IDbConnectionInfo { if(is_string($dsn)) { @@ -141,7 +141,7 @@ class MariaDBBackend implements IDbBackend { if($endPoint === null) throw new InvalidArgumentException('No end point could be determined from the provided DSN.'); - return new MariaDBConnectionInfo( + return new MariaDbConnectionInfo( $endPoint, $user, $pass, $dbName, $charSet, $initCommand, $keyPath, $certPath, $certAuthPath, $trustedCertsPath, $cipherAlgos, diff --git a/src/Data/MariaDB/MariaDBCharacterSetInfo.php b/src/Data/MariaDb/MariaDBCharacterSetInfo.php similarity index 94% rename from src/Data/MariaDB/MariaDBCharacterSetInfo.php rename to src/Data/MariaDb/MariaDBCharacterSetInfo.php index 153b53e..cbce06a 100644 --- a/src/Data/MariaDB/MariaDBCharacterSetInfo.php +++ b/src/Data/MariaDb/MariaDBCharacterSetInfo.php @@ -1,21 +1,21 @@ connection->get_charset()); + public function getCharacterSetInfo(): MariaDbCharacterSetInfo { + return new MariaDbCharacterSetInfo($this->connection->get_charset()); } /** @@ -209,7 +209,7 @@ class MariaDBConnection implements IDbConnection, IDbTransactions { * @return string Version of the server. */ public function getServerVersion(): string { - return MariaDBBackend::intToVersion($this->connection->server_version); + return MariaDbBackend::intToVersion($this->connection->server_version); } /** @@ -242,13 +242,13 @@ class MariaDBConnection implements IDbConnection, IDbTransactions { /** * Gets a list of errors from the last command. * - * @return MariaDBWarning[] List of last errors. + * @return MariaDbWarning[] List of last errors. */ public function getLastErrors(): array { // imagine if stdlib stuff had type annotations, couldn't be me /** @var array */ $errorList = $this->connection->error_list; - return MariaDBWarning::fromLastErrors($errorList); + return MariaDbWarning::fromLastErrors($errorList); } /** @@ -265,10 +265,10 @@ class MariaDBConnection implements IDbConnection, IDbTransactions { * * The result of SHOW WARNINGS; * - * @return MariaDBWarning[] List of warnings. + * @return MariaDbWarning[] List of warnings. */ public function getWarnings(): array { - return MariaDBWarning::fromGetWarnings($this->connection->get_warnings()); + return MariaDbWarning::fromGetWarnings($this->connection->get_warnings()); } /** @@ -351,9 +351,9 @@ class MariaDBConnection implements IDbConnection, IDbTransactions { } /** - * @return MariaDBStatement A database statement. + * @return MariaDbStatement A database statement. */ - public function prepare(string $query): MariaDBStatement { + public function prepare(string $query): MariaDbStatement { try { $statement = $this->connection->prepare($query); } catch(mysqli_sql_exception $ex) { @@ -361,13 +361,13 @@ class MariaDBConnection implements IDbConnection, IDbTransactions { } if($statement === false) throw new RuntimeException($this->getLastErrorString(), $this->getLastErrorCode()); - return new MariaDBStatement($statement); + return new MariaDbStatement($statement); } /** - * @return MariaDBResult A database result. + * @return MariaDbResult A database result. */ - public function query(string $query): MariaDBResult { + public function query(string $query): MariaDbResult { try { $result = $this->connection->query($query, MYSQLI_STORE_RESULT); } catch(mysqli_sql_exception $ex) { @@ -382,7 +382,7 @@ class MariaDBConnection implements IDbConnection, IDbTransactions { throw new RuntimeException('Query succeeded but you should have use the execute method for that query.'); // Yes, this always uses Native, for some reason the stupid limitation in libmysql only applies to preparing - return new MariaDBResultNative($result); + return new MariaDbResultNative($result); } public function execute(string $query): int|string { diff --git a/src/Data/MariaDB/MariaDBConnectionInfo.php b/src/Data/MariaDb/MariaDBConnectionInfo.php similarity index 93% rename from src/Data/MariaDB/MariaDBConnectionInfo.php rename to src/Data/MariaDb/MariaDBConnectionInfo.php index 2b0e00b..569dd2c 100644 --- a/src/Data/MariaDB/MariaDBConnectionInfo.php +++ b/src/Data/MariaDb/MariaDBConnectionInfo.php @@ -1,20 +1,20 @@ endPoint instanceof DnsEndPoint) return $this->endPoint->getHost(); - if($this->endPoint instanceof IPEndPoint) + if($this->endPoint instanceof IpEndPoint) return $this->endPoint->getAddress()->getCleanAddress(); return ''; } @@ -108,7 +108,7 @@ class MariaDBConnectionInfo implements IDbConnectionInfo { * @return int Target port number. */ public function getPort(): int { - if(($this->endPoint instanceof DnsEndPoint) || ($this->endPoint instanceof IPEndPoint)) { + if(($this->endPoint instanceof DnsEndPoint) || ($this->endPoint instanceof IpEndPoint)) { $port = $this->endPoint->getPort(); return $port < 1 ? 3306 : $port; } @@ -283,7 +283,7 @@ class MariaDBConnectionInfo implements IDbConnectionInfo { * @param string|null $cipherAlgos List of SSL encryption cipher that are allowed. * @param bool $verifyCert true if the client should verify the server's SSL certificate, false if not. * @param bool $useCompression true if compression should be used, false if not. - * @return MariaDBConnectionInfo A connection info instance representing the given information. + * @return MariaDbConnectionInfo A connection info instance representing the given information. */ public static function createHost( string $host, @@ -300,8 +300,8 @@ class MariaDBConnectionInfo implements IDbConnectionInfo { string|null $cipherAlgos = null, bool $verifyCert = false, bool $useCompression = false - ): MariaDBConnectionInfo { - return new MariaDBConnectionInfo( + ): MariaDbConnectionInfo { + return new MariaDbConnectionInfo( new DnsEndPoint($host, $port), $userName, $password, @@ -334,7 +334,7 @@ class MariaDBConnectionInfo implements IDbConnectionInfo { * @param string|null $cipherAlgos List of SSL encryption cipher that are allowed. * @param bool $verifyCert true if the client should verify the server's SSL certificate, false if not. * @param bool $useCompression true if compression should be used, false if not. - * @return MariaDBConnectionInfo A connection info instance representing the given information. + * @return MariaDbConnectionInfo A connection info instance representing the given information. */ public static function createUnix( string $path, @@ -350,8 +350,8 @@ class MariaDBConnectionInfo implements IDbConnectionInfo { string|null $cipherAlgos = null, bool $verifyCert = false, bool $useCompression = false - ): MariaDBConnectionInfo { - return new MariaDBConnectionInfo( + ): MariaDbConnectionInfo { + return new MariaDbConnectionInfo( UnixEndPoint::parse($path), $userName, $password, @@ -386,7 +386,7 @@ class MariaDBConnectionInfo implements IDbConnectionInfo { * @param string|null $cipherAlgos List of SSL encryption cipher that are allowed. * @param bool $verifyCert true if the client should verify the server's SSL certificate, false if not. * @param bool $useCompression true if compression should be used, false if not. - * @return MariaDBConnectionInfo A connection info instance representing the given information. + * @return MariaDbConnectionInfo A connection info instance representing the given information. */ public static function create( string $endPoint, @@ -402,8 +402,8 @@ class MariaDBConnectionInfo implements IDbConnectionInfo { string|null $cipherAlgos = null, bool $verifyCert = false, bool $useCompression = false - ): MariaDBConnectionInfo { - return new MariaDBConnectionInfo( + ): MariaDbConnectionInfo { + return new MariaDbConnectionInfo( EndPoint::parse($endPoint), $userName, $password, diff --git a/src/Data/MariaDB/MariaDBParameter.php b/src/Data/MariaDb/MariaDBParameter.php similarity index 89% rename from src/Data/MariaDB/MariaDBParameter.php rename to src/Data/MariaDb/MariaDBParameter.php index 3d2abaf..1c4d168 100644 --- a/src/Data/MariaDB/MariaDBParameter.php +++ b/src/Data/MariaDb/MariaDBParameter.php @@ -1,23 +1,23 @@ */ protected array $currentRow = []; /** - * Creates a new MariaDBResult instance. + * Creates a new MariaDbResult instance. * * @param mysqli_stmt|mysqli_result $result A result to work with. - * @return MariaDBResult A result instance. + * @return MariaDbResult A result instance. */ public function __construct( protected mysqli_stmt|mysqli_result $result diff --git a/src/Data/MariaDB/MariaDBResultLib.php b/src/Data/MariaDb/MariaDBResultLib.php similarity index 90% rename from src/Data/MariaDB/MariaDBResultLib.php rename to src/Data/MariaDb/MariaDBResultLib.php index 8af124a..563b3a3 100644 --- a/src/Data/MariaDB/MariaDBResultLib.php +++ b/src/Data/MariaDb/MariaDBResultLib.php @@ -1,19 +1,19 @@ get_result(); diff --git a/src/Data/MariaDB/MariaDBStatement.php b/src/Data/MariaDb/MariaDBStatement.php similarity index 82% rename from src/Data/MariaDB/MariaDBStatement.php rename to src/Data/MariaDb/MariaDBStatement.php index c8998fb..8808f2f 100644 --- a/src/Data/MariaDB/MariaDBStatement.php +++ b/src/Data/MariaDb/MariaDBStatement.php @@ -1,28 +1,28 @@ */ +class MariaDbStatement implements IDbStatement { + /** @var array */ private array $params = []; /** - * Creates a MariaDBStatement. + * Creates a MariaDbStatement. * * @param mysqli_stmt $statement Underlying statement object. - * @return MariaDBStatement A new statement instance. + * @return MariaDbStatement A new statement instance. */ public function __construct( private mysqli_stmt $statement @@ -30,11 +30,11 @@ class MariaDBStatement implements IDbStatement { private static bool $constructed = false; - /** @var class-string */ + /** @var class-string */ private static string $resultImplementation; /** - * Determines which MariaDBResult implementation should be used. + * Determines which MariaDbResult implementation should be used. * * @internal */ @@ -43,8 +43,8 @@ class MariaDBStatement implements IDbStatement { throw new RuntimeException('Static constructor was already called.'); self::$constructed = true; self::$resultImplementation = function_exists('mysqli_stmt_get_result') - ? MariaDBResultNative::class - : MariaDBResultLib::class; + ? MariaDbResultNative::class + : MariaDbResultLib::class; } public function getParameterCount(): int { @@ -55,7 +55,7 @@ class MariaDBStatement implements IDbStatement { if($ordinal < 1 || $ordinal > $this->getParameterCount()) throw new InvalidArgumentException('$ordinal is not a valid parameter number.'); - $this->params[$ordinal - 1] = new MariaDBParameter($ordinal, $type, $value); + $this->params[$ordinal - 1] = new MariaDbParameter($ordinal, $type, $value); } public function nextParameter(mixed $value, int $type = DbType::AUTO): void { @@ -63,7 +63,7 @@ class MariaDBStatement implements IDbStatement { if($nextIndex >= $this->getParameterCount()) throw new RuntimeException('Attempted to specify too many parameters.'); - $this->params[$nextIndex] = new MariaDBParameter($nextIndex + 1, $type, $value); + $this->params[$nextIndex] = new MariaDbParameter($nextIndex + 1, $type, $value); } /** @@ -96,10 +96,10 @@ class MariaDBStatement implements IDbStatement { /** * Gets a list of errors from the last command. * - * @return MariaDBWarning[] List of last errors. + * @return MariaDbWarning[] List of last errors. */ public function getLastErrors(): array { - return MariaDBWarning::fromLastErrors($this->statement->error_list); + return MariaDbWarning::fromLastErrors($this->statement->error_list); } /** @@ -107,13 +107,13 @@ class MariaDBStatement implements IDbStatement { * * The result of SHOW WARNINGS; * - * @return MariaDBWarning[] List of warnings. + * @return MariaDbWarning[] List of warnings. */ public function getWarnings(): array { - return MariaDBWarning::fromGetWarnings($this->statement->get_warnings()); + return MariaDbWarning::fromGetWarnings($this->statement->get_warnings()); } - public function getResult(): MariaDBResult { + public function getResult(): MariaDbResult { return new self::$resultImplementation($this->statement); } @@ -173,4 +173,4 @@ class MariaDBStatement implements IDbStatement { } } -MariaDBStatement::construct(); +MariaDbStatement::construct(); diff --git a/src/Data/MariaDB/MariaDBWarning.php b/src/Data/MariaDb/MariaDBWarning.php similarity index 82% rename from src/Data/MariaDB/MariaDBWarning.php rename to src/Data/MariaDb/MariaDBWarning.php index 346c4d1..95f63ec 100644 --- a/src/Data/MariaDB/MariaDBWarning.php +++ b/src/Data/MariaDb/MariaDBWarning.php @@ -1,9 +1,9 @@ $errors Array of warning arrays. - * @return MariaDBWarning[] Array of warnings objects. + * @return MariaDbWarning[] Array of warnings objects. */ public static function fromLastErrors(array $errors): array { - return XArray::select($errors, fn($error) => new MariaDBWarning($error['error'], $error['sqlstate'], $error['errno'])); + return XArray::select($errors, fn($error) => new MariaDbWarning($error['error'], $error['sqlstate'], $error['errno'])); } /** * Creates an array of warning objects from a mysqli_warning instance. * * @param mysqli_warning|false $warnings Warning object. - * @return MariaDBWarning[] Array of warning objects. + * @return MariaDbWarning[] Array of warning objects. */ public static function fromGetWarnings(mysqli_warning|false $warnings): array { $array = []; if($warnings !== false) do { - $array[] = new MariaDBWarning( + $array[] = new MariaDbWarning( $warnings->message, $warnings->sqlstate, $warnings->errno diff --git a/src/Data/Migration/DbMigrationManager.php b/src/Data/Migration/DbMigrationManager.php index 48766aa..dae138a 100644 --- a/src/Data/Migration/DbMigrationManager.php +++ b/src/Data/Migration/DbMigrationManager.php @@ -1,7 +1,7 @@ conn instanceof SQLiteConnection ? 'TEXT' : 'VARCHAR(255)'; + // TODO: ACTUALLY get rid of this + $nameType = $this->conn instanceof SqliteConnection ? 'TEXT' : 'VARCHAR(255)'; $this->conn->execute(sprintf(self::CREATE_TRACK_TABLE, $this->tableName, $nameType)); $this->conn->execute(sprintf(self::CREATE_TRACK_INDEX, $this->tableName)); @@ -120,7 +121,7 @@ EOF; if($this->insertStmt === null) throw new RuntimeException('Database migration manager has not been initialised.'); - $dateTime = XDateTime::toISO8601String($dateTime); + $dateTime = XDateTime::toIso8601String($dateTime); $this->insertStmt->reset(); $this->insertStmt->addParameter(1, $name, DbType::STRING); diff --git a/src/Data/NullDb/NullDbResult.php b/src/Data/NullDb/NullDbResult.php index 98c53b0..155db60 100644 --- a/src/Data/NullDb/NullDbResult.php +++ b/src/Data/NullDb/NullDbResult.php @@ -1,12 +1,12 @@ $dsn DSN with connection information. - * @return SQLiteConnectionInfo SQLite connection info. + * @return SqliteConnectionInfo SQLite connection info. */ public function parseDsn(string|array $dsn): IDbConnectionInfo { if(is_string($dsn)) { @@ -78,6 +78,6 @@ class SQLiteBackend implements IDbBackend { $readOnly = isset($query['readOnly']); $create = !isset($query['openOnly']); - return new SQLiteConnectionInfo($path, $encKey, $readOnly, $create); + return new SqliteConnectionInfo($path, $encKey, $readOnly, $create); } } diff --git a/src/Data/SQLite/SQLiteConnection.php b/src/Data/Sqlite/SqliteConnection.php similarity index 96% rename from src/Data/SQLite/SQLiteConnection.php rename to src/Data/Sqlite/SqliteConnection.php index 9f8b274..b1ad476 100644 --- a/src/Data/SQLite/SQLiteConnection.php +++ b/src/Data/Sqlite/SqliteConnection.php @@ -1,19 +1,19 @@ shouldReadOnly()) $flags |= SQLITE3_OPEN_READONLY; @@ -460,7 +460,7 @@ class SQLiteConnection implements IDbConnection, IDbTransactions { /** * Opens a BLOB field as a Stream. * - * To be used instead of getStream on SQLiteResult. + * To be used instead of getStream on SqliteResult. * * @param string $table Name of the source table. * @param string $column Name of the source column. @@ -484,14 +484,14 @@ class SQLiteConnection implements IDbConnection, IDbTransactions { $statement = $this->connection->prepare($query); if($statement === false) throw new RuntimeException((string)$this->getLastErrorString(), $this->getLastErrorCode()); - return new SQLiteStatement($this, $statement); + return new SqliteStatement($this, $statement); } public function query(string $query): IDbResult { $result = $this->connection->query($query); if($result === false) throw new RuntimeException($this->getLastErrorString(), $this->getLastErrorCode()); - return new SQLiteResult($result); + return new SqliteResult($result); } public function execute(string $query): int|string { diff --git a/src/Data/SQLite/SQLiteConnectionInfo.php b/src/Data/Sqlite/SqliteConnectionInfo.php similarity index 79% rename from src/Data/SQLite/SQLiteConnectionInfo.php rename to src/Data/Sqlite/SqliteConnectionInfo.php index 72cf4bc..dce8276 100644 --- a/src/Data/SQLite/SQLiteConnectionInfo.php +++ b/src/Data/Sqlite/SqliteConnectionInfo.php @@ -1,24 +1,24 @@ */ private array $currentRow = []; /** - * Creates a new instance of SQLiteResult. + * Creates a new instance of SqliteResult. * * @param SQLite3Result $result Raw underlying result class. - * @return SQLiteResult A new SQLiteResult instance. + * @return SqliteResult A new SqliteResult instance. */ public function __construct( private SQLite3Result $result @@ -56,7 +56,7 @@ class SQLiteResult implements IDbResult { /** * Gets the value from the target index as a Stream. - * If you're aware that you're using SQLite it may make more sense to use SQLiteConnection::getBlobStream instead. + * If you're aware that you're using SQLite it may make more sense to use SqliteConnection::getBlobStream instead. */ public function getStream(int|string $index): ?Stream { if($this->isNull($index)) diff --git a/src/Data/SQLite/SQLiteStatement.php b/src/Data/Sqlite/SqliteStatement.php similarity index 88% rename from src/Data/SQLite/SQLiteStatement.php rename to src/Data/Sqlite/SqliteStatement.php index 8c619d8..c5b8e0d 100644 --- a/src/Data/SQLite/SQLiteStatement.php +++ b/src/Data/Sqlite/SqliteStatement.php @@ -1,33 +1,33 @@ result === null) throw new RuntimeException('No result is available.'); - return new SQLiteResult($this->result); + return new SqliteResult($this->result); } public function getLastInsertId(): int|string { diff --git a/src/Http/Content/BencodedContent.php b/src/Http/Content/BencodedContent.php index d4eee23..60ac804 100644 --- a/src/Http/Content/BencodedContent.php +++ b/src/Http/Content/BencodedContent.php @@ -1,12 +1,12 @@ setTypeHTML(); + $response->setTypeHtml(); $charSet = mb_preferred_mime_name(mb_internal_encoding()); if($charSet === false) diff --git a/src/Http/HttpMessage.php b/src/Http/HttpMessage.php index b129a4b..e7b53e6 100644 --- a/src/Http/HttpMessage.php +++ b/src/Http/HttpMessage.php @@ -1,12 +1,12 @@ setContentType('text/html; charset=' . $charset); } @@ -266,7 +266,7 @@ class HttpResponseBuilder extends HttpMessageBuilder { * * @param string $charset Character set. */ - public function setTypeXML(string $charset = 'utf-8'): void { + public function setTypeXml(string $charset = 'utf-8'): void { $this->setContentType('application/xml; charset=' . $charset); } @@ -275,7 +275,7 @@ class HttpResponseBuilder extends HttpMessageBuilder { * * @param string $charset Character set. */ - public function setTypeCSS(string $charset = 'utf-8'): void { + public function setTypeCss(string $charset = 'utf-8'): void { $this->setContentType('text/css; charset=' . $charset); } @@ -284,7 +284,7 @@ class HttpResponseBuilder extends HttpMessageBuilder { * * @param string $charset Character set. */ - public function setTypeJS(string $charset = 'utf-8'): void { + public function setTypeJs(string $charset = 'utf-8'): void { $this->setContentType('application/javascript; charset=' . $charset); } diff --git a/src/Http/HttpUploadedFile.php b/src/Http/HttpUploadedFile.php index 8079fe6..d9b4895 100644 --- a/src/Http/HttpUploadedFile.php +++ b/src/Http/HttpUploadedFile.php @@ -1,14 +1,14 @@ $file File info array. * @return HttpUploadedFile Uploaded file info. */ - public static function createFromFILE(array $file): self { + public static function createFromPhpFilesEntry(array $file): self { return new HttpUploadedFile( (int)($file['error'] ?? UPLOAD_ERR_NO_FILE), (int)($file['size'] ?? -1), @@ -182,18 +182,18 @@ class HttpUploadedFile implements ICloseable { * @param array $files Value of a $_FILES superglobal. * @return array> Uploaded files. */ - public static function createFromFILES(array $files): array { + public static function createFromPhpFiles(array $files): array { if(empty($files)) return []; - return self::createObjectInstances(self::normalizeFILES($files)); + return self::createObjectInstances(self::normalizePhpFiles($files)); } /** * @param array $files * @return array */ - private static function traverseFILES(array $files, string $keyName): array { + private static function traversePhpFiles(array $files, string $keyName): array { $arr = []; foreach($files as $key => $val) { @@ -201,7 +201,7 @@ class HttpUploadedFile implements ICloseable { if(is_array($val)) { /** @var array $val */ - $arr[$key] = self::traverseFILES($val, $keyName); + $arr[$key] = self::traversePhpFiles($val, $keyName); } else { $arr[$key][$keyName] = $val; } @@ -214,7 +214,7 @@ class HttpUploadedFile implements ICloseable { * @param array $files * @return array */ - private static function normalizeFILES(array $files): array { + private static function normalizePhpFiles(array $files): array { $out = []; foreach($files as $key => $arr) { @@ -240,7 +240,7 @@ class HttpUploadedFile implements ICloseable { $mergeWith = $out[$key] ?? []; /** @var array $source */ - $out[$key] = array_merge_recursive($mergeWith, self::traverseFILES($source, (string)$keyName)); + $out[$key] = array_merge_recursive($mergeWith, self::traversePhpFiles($source, (string)$keyName)); } continue; } @@ -264,7 +264,7 @@ class HttpUploadedFile implements ICloseable { if(isset($val['error'])) /** @var array $val */ - $coll[$key] = self::createFromFILE($val); + $coll[$key] = self::createFromPhpFilesEntry($val); else /** @var array $val */ $coll[$key] = self::createObjectInstances($val); diff --git a/src/Http/Routing/HttpRouter.php b/src/Http/Routing/HttpRouter.php index f61d0bc..d1e6a8d 100644 --- a/src/Http/Routing/HttpRouter.php +++ b/src/Http/Routing/HttpRouter.php @@ -1,7 +1,7 @@ hasContentType()) { if(strtolower(substr($result, 0, 14)) === 'setTypeHTML($this->getCharSet()); + $response->setTypeHtml($this->getCharSet()); else { $charset = mb_detect_encoding($result); if($charset !== false) @@ -303,7 +303,7 @@ class HttpRouter implements IRouter { $charset = $charset === false ? 'utf-8' : strtolower($charset); if(strtolower(substr($result, 0, 5)) === 'setTypeXML($charset); + $response->setTypeXml($charset); else $response->setTypePlain($charset); } diff --git a/src/IO/FileStream.php b/src/Io/FileStream.php similarity index 99% rename from src/IO/FileStream.php rename to src/Io/FileStream.php index 02a0964..472bf23 100644 --- a/src/IO/FileStream.php +++ b/src/Io/FileStream.php @@ -1,9 +1,9 @@ getAddress(), $port, $timeout); } /** - * Opens an SSL network socket stream to an endpoint represented by an Index IPAddress instance and port. + * Opens an SSL network socket stream to an endpoint represented by an Index IpAddress instance and port. * - * @param IPAddress $address Address to connect to. + * @param IpAddress $address Address to connect to. * @param int $port Port to connect at. * @param float|null $timeout Amount of seconds until timeout, null for php.ini default. */ - public static function openAddressSSL(IPAddress $address, int $port, float|null $timeout = null): NetworkStream { + public static function openAddressSSL(IpAddress $address, int $port, float|null $timeout = null): NetworkStream { return new NetworkStream('ssl://' . $address->getAddress(), $port, $timeout); } /** - * Opens a TLS network socket stream to an endpoint represented by an Index IPAddress instance and port. + * Opens a TLS network socket stream to an endpoint represented by an Index IpAddress instance and port. * - * @param IPAddress $address Address to connect to. + * @param IpAddress $address Address to connect to. * @param int $port Port to connect at. * @param float|null $timeout Amount of seconds until timeout, null for php.ini default. */ - public static function openAddressTLS(IPAddress $address, int $port, float|null $timeout = null): NetworkStream { + public static function openAddressTLS(IpAddress $address, int $port, float|null $timeout = null): NetworkStream { return new NetworkStream('tls://' . $address->getAddress(), $port, $timeout); } diff --git a/src/IO/ProcessStream.php b/src/Io/ProcessStream.php similarity index 98% rename from src/IO/ProcessStream.php rename to src/Io/ProcessStream.php index dc728d4..4da2560 100644 --- a/src/IO/ProcessStream.php +++ b/src/Io/ProcessStream.php @@ -1,9 +1,9 @@ getRaw() === $other->getRaw(); + return $other instanceof IpAddress && $this->getRaw() === $other->getRaw(); } #[\Override] @@ -151,7 +151,7 @@ final class IPAddress implements JsonSerializable, Stringable, IEquatable { * * @param string $string String to parse. * @throws InvalidArgumentException If $string does not contain a valid IP address string. - * @return IPAddress Representation of the given string. + * @return IpAddress Representation of the given string. */ public static function parse(string $string): self { $parsed = inet_pton($string); diff --git a/src/Net/IPAddressRange.php b/src/Net/IpAddressRange.php similarity index 79% rename from src/Net/IPAddressRange.php rename to src/Net/IpAddressRange.php index 8d8569d..8182cbd 100644 --- a/src/Net/IPAddressRange.php +++ b/src/Net/IpAddressRange.php @@ -1,7 +1,7 @@ base; } @@ -55,7 +55,7 @@ final class IPAddressRange implements JsonSerializable, Stringable, IEquatable { } public function equals(mixed $other): bool { - return $other instanceof IPAddressRange + return $other instanceof IpAddressRange && $this->mask === $other->mask && $this->base->equals($other->base); } @@ -63,10 +63,10 @@ final class IPAddressRange implements JsonSerializable, Stringable, IEquatable { /** * Checks if a given IP address matches with this range. * - * @param IPAddress $address IP address to check. + * @param IpAddress $address IP address to check. * @return bool true if the address matches. */ - public function match(IPAddress $address): bool { + public function match(IpAddress $address): bool { $width = $this->base->getWidth(); if($address->getWidth() !== $width) return false; @@ -111,7 +111,7 @@ final class IPAddressRange implements JsonSerializable, Stringable, IEquatable { /** @param array{b: string, m: int} $serialized */ public function __unserialize(array $serialized): void { - $this->base = new IPAddress($serialized['b']); + $this->base = new IpAddress($serialized['b']); $this->mask = $serialized['m']; } @@ -120,12 +120,12 @@ final class IPAddressRange implements JsonSerializable, Stringable, IEquatable { * * @param string $string String to parse. * @throws InvalidArgumentException If $string does not contain a valid CIDR range string. - * @return IPAddressRange Representation of the given string. + * @return IpAddressRange Representation of the given string. */ - public static function parse(string $string): IPAddressRange { + public static function parse(string $string): IpAddressRange { $parts = explode('/', $string, 2); if(empty($parts[0]) || empty($parts[1])) throw new InvalidArgumentException('$string is not a valid CIDR range.'); - return new static(IPAddress::parse($parts[0]), (int)$parts[1]); + return new static(IpAddress::parse($parts[0]), (int)$parts[1]); } } diff --git a/src/Net/IPEndPoint.php b/src/Net/IpEndPoint.php similarity index 82% rename from src/Net/IPEndPoint.php rename to src/Net/IpEndPoint.php index c745296..1a457f9 100644 --- a/src/Net/IPEndPoint.php +++ b/src/Net/IpEndPoint.php @@ -1,7 +1,7 @@ 0xFFFF) @@ -28,9 +28,9 @@ class IPEndPoint extends EndPoint { /** * Returns the IP address. * - * @return IPAddress IP address. + * @return IpAddress IP address. */ - public function getAddress(): IPAddress { + public function getAddress(): IpAddress { return $this->address; } @@ -56,14 +56,14 @@ class IPEndPoint extends EndPoint { return [$this->address, $this->port]; } - /** @param array{IPAddress, int} $serialized */ + /** @param array{IpAddress, int} $serialized */ public function __unserialize(array $serialized): void { $this->address = $serialized[0]; $this->port = $serialized[1]; } public function equals(mixed $other): bool { - return $other instanceof IPEndPoint + return $other instanceof IpEndPoint && $this->port === $other->port && $this->address->equals($other->address); } @@ -73,9 +73,9 @@ class IPEndPoint extends EndPoint { * * @param string $string String to parse. * @throws InvalidArgumentException If $string does not contain a valid IP end point string. - * @return IPEndPoint Representation of the given string. + * @return IpEndPoint Representation of the given string. */ - public static function parse(string $string): IPEndPoint { + public static function parse(string $string): IpEndPoint { if(str_starts_with($string, '[')) { // IPv6 $closing = strpos($string, ']'); if($closing === false) @@ -90,7 +90,7 @@ class IPEndPoint extends EndPoint { $port = (int)$parts[1]; } - return new IPEndPoint(IPAddress::parse($ip), $port); + return new IpEndPoint(IpAddress::parse($ip), $port); } public function __toString(): string { diff --git a/src/XDateTime.php b/src/XDateTime.php index dde5366..127445b 100644 --- a/src/XDateTime.php +++ b/src/XDateTime.php @@ -1,7 +1,7 @@ getEndPoints(); $this->assertEquals(1, count($endPoints)); - $this->assertInstanceOf(IPEndPoint::class, $endPoints[0][0]); + $this->assertInstanceOf(IpEndPoint::class, $endPoints[0][0]); $this->assertEquals('127.0.0.1', (string)$endPoints[0][0]->getAddress()); $this->assertEquals(0, $endPoints[0][0]->getPort()); $this->assertEquals(0, $endPoints[0][1]); @@ -69,7 +69,7 @@ final class CacheToolsTest extends TestCase { $endPoints = $info->getEndPoints(); $this->assertEquals(1, count($endPoints)); - $this->assertInstanceOf(IPEndPoint::class, $endPoints[0][0]); + $this->assertInstanceOf(IpEndPoint::class, $endPoints[0][0]); $this->assertEquals('::1', (string)$endPoints[0][0]->getAddress()); $this->assertEquals(9001, $endPoints[0][0]->getPort()); $this->assertEquals(0, $endPoints[0][1]); @@ -106,12 +106,12 @@ final class CacheToolsTest extends TestCase { $this->assertEquals('/var/run/memcached.sock', $endPoints[0][0]->getPath()); $this->assertEquals(20, $endPoints[0][1]); - $this->assertInstanceOf(IPEndPoint::class, $endPoints[1][0]); + $this->assertInstanceOf(IpEndPoint::class, $endPoints[1][0]); $this->assertEquals('127.0.0.1', (string)$endPoints[1][0]->getAddress()); $this->assertEquals(0, $endPoints[1][0]->getPort()); $this->assertEquals(10, $endPoints[1][1]); - $this->assertInstanceOf(IPEndPoint::class, $endPoints[2][0]); + $this->assertInstanceOf(IpEndPoint::class, $endPoints[2][0]); $this->assertEquals('::1', (string)$endPoints[2][0]->getAddress()); $this->assertEquals(9001, $endPoints[2][0]->getPort()); $this->assertEquals(5, $endPoints[2][1]); @@ -150,7 +150,7 @@ final class CacheToolsTest extends TestCase { // ipv4 $info = $valkey->parseDsn('keydb://password@127.0.0.1:6379?db=123'); - $this->assertInstanceOf(IPEndPoint::class, $info->getEndPoint()); + $this->assertInstanceOf(IpEndPoint::class, $info->getEndPoint()); $this->assertEquals('127.0.0.1', $info->getServerHost()); $this->assertEquals(6379, $info->getServerPort()); $this->assertEmpty($info->getPrefix()); @@ -165,7 +165,7 @@ final class CacheToolsTest extends TestCase { // ipv6 $info = $valkey->parseDsn('redis://username:password@[::1]/?persist&db=1'); - $this->assertInstanceOf(IPEndPoint::class, $info->getEndPoint()); + $this->assertInstanceOf(IpEndPoint::class, $info->getEndPoint()); $this->assertEquals('::1', $info->getServerHost()); $this->assertEquals(0, $info->getServerPort()); $this->assertEmpty($info->getPrefix()); diff --git a/tests/ColourTest.php b/tests/ColourTest.php index 27a5ab4..1e155f8 100644 --- a/tests/ColourTest.php +++ b/tests/ColourTest.php @@ -1,19 +1,19 @@ assertTrue($colour->isDark()); $this->assertFalse($colour->isLight()); } for($i = 0xB; $i < 0x10; ++$i) { $num = ($i << 4) | $i; - $colour = new ColourRGB($num, $num, $num, 1); + $colour = new ColourRgb($num, $num, $num, 1); $this->assertFalse($colour->isDark()); $this->assertTrue($colour->isLight()); } @@ -70,45 +70,45 @@ final class ColourTest extends TestCase { } public function testRGB(): void { - $colour = new ColourRGB(31, 120, 50, 1.0); + $colour = new ColourRgb(31, 120, 50, 1.0); $this->assertEquals(31, $colour->getRed()); $this->assertEquals(120, $colour->getGreen()); $this->assertEquals(50, $colour->getBlue()); $this->assertEquals(1.0, $colour->getAlpha()); - $this->assertInstanceOf(ColourRGB::class, $colour); + $this->assertInstanceOf(ColourRgb::class, $colour); $this->assertFalse($colour->shouldInherit()); $this->assertFalse($colour->isLight()); $this->assertTrue($colour->isDark()); $this->assertEquals('#1f7832', $colour); - $colour = ColourRGB::fromRawARGB(0xCCFF7A7F); + $colour = ColourRgb::fromRawArgb(0xCCFF7A7F); $this->assertEquals(255, $colour->getRed()); $this->assertEquals(122, $colour->getGreen()); $this->assertEquals(127, $colour->getBlue()); $this->assertEquals(.8, $colour->getAlpha()); - $this->assertInstanceOf(ColourRGB::class, $colour); + $this->assertInstanceOf(ColourRgb::class, $colour); $this->assertFalse($colour->shouldInherit()); $this->assertFalse($colour->isLight()); $this->assertTrue($colour->isDark()); $this->assertEquals('rgba(255, 122, 127, 0.8)', $colour); - $colour = ColourRGB::fromRawRGB(0x4D3380); + $colour = ColourRgb::fromRawRgb(0x4D3380); $this->assertEquals(77, $colour->getRed()); $this->assertEquals(51, $colour->getGreen()); $this->assertEquals(128, $colour->getBlue()); $this->assertEquals(1.0, $colour->getAlpha()); - $this->assertInstanceOf(ColourRGB::class, $colour); + $this->assertInstanceOf(ColourRgb::class, $colour); $this->assertFalse($colour->shouldInherit()); $this->assertFalse($colour->isLight()); $this->assertTrue($colour->isDark()); $this->assertEquals('#4d3380', $colour); - $colour = ColourRGB::fromRawRGBA(0xFF7A7F33); + $colour = ColourRgb::fromRawRgba(0xFF7A7F33); $this->assertEquals(255, $colour->getRed()); $this->assertEquals(122, $colour->getGreen()); $this->assertEquals(127, $colour->getBlue()); $this->assertEquals(.2, $colour->getAlpha()); - $this->assertInstanceOf(ColourRGB::class, $colour); + $this->assertInstanceOf(ColourRgb::class, $colour); $this->assertFalse($colour->shouldInherit()); $this->assertFalse($colour->isLight()); $this->assertTrue($colour->isDark()); @@ -116,41 +116,41 @@ final class ColourTest extends TestCase { } public function testConvertToRGB(): void { - $colourA = new ColourRGB(31, 120, 50, 1.0); - $colourB = ColourRGB::convert($colourA); + $colourA = new ColourRgb(31, 120, 50, 1.0); + $colourB = ColourRgb::convert($colourA); $this->assertSame($colourA, $colourB); // converting to the same type should passthru $colourA = Colour::none(); - $colourB = ColourRGB::convert($colourA); // converting none to RGB makes very little sense, but you can do it if you want... + $colourB = ColourRgb::convert($colourA); // converting none to RGB makes very little sense, but you can do it if you want... $this->assertEquals(0, $colourB->getRed()); $this->assertEquals(0, $colourB->getGreen()); $this->assertEquals(0, $colourB->getBlue()); $this->assertEquals(1.0, $colourB->getAlpha()); - $this->assertInstanceOf(ColourRGB::class, $colourB); + $this->assertInstanceOf(ColourRgb::class, $colourB); $this->assertFalse($colourB->shouldInherit()); // it does lose the inherit flag, which is intentional $this->assertFalse($colourB->isLight()); $this->assertTrue($colourB->isDark()); $this->assertEquals('#000000', $colourB); $colourA = new ColourNamed('steelblue'); - $colourB = ColourRGB::convert($colourA); + $colourB = ColourRgb::convert($colourA); $this->assertEquals(0x46, $colourB->getRed()); $this->assertEquals(0x82, $colourB->getGreen()); $this->assertEquals(0xB4, $colourB->getBlue()); $this->assertEquals(1.0, $colourB->getAlpha()); - $this->assertInstanceOf(ColourRGB::class, $colourB); + $this->assertInstanceOf(ColourRgb::class, $colourB); $this->assertFalse($colourB->shouldInherit()); $this->assertFalse($colourB->isLight()); $this->assertTrue($colourB->isDark()); $this->assertEquals('#4682b4', $colourB); - $colourA = new ColourHSL(50, .8, .4, 1.0); - $colourB = ColourRGB::convert($colourA); + $colourA = new ColourHsl(50, .8, .4, 1.0); + $colourB = ColourRgb::convert($colourA); $this->assertEquals(0xB8, $colourB->getRed()); $this->assertEquals(0x9C, $colourB->getGreen()); $this->assertEquals(0x14, $colourB->getBlue()); $this->assertEquals(1.0, $colourB->getAlpha()); - $this->assertInstanceOf(ColourRGB::class, $colourB); + $this->assertInstanceOf(ColourRgb::class, $colourB); $this->assertFalse($colourB->shouldInherit()); $this->assertFalse($colourB->isLight()); $this->assertTrue($colourB->isDark()); @@ -158,7 +158,7 @@ final class ColourTest extends TestCase { } public function testHSL(): void { - $colour = new ColourHSL(50, .8, .4, 1.0); + $colour = new ColourHsl(50, .8, .4, 1.0); $this->assertEquals(50, $colour->getHue()); $this->assertEquals(.8, $colour->getSaturation()); $this->assertEquals(.4, $colour->getLightness()); @@ -166,13 +166,13 @@ final class ColourTest extends TestCase { $this->assertEquals(0x9C, $colour->getGreen()); $this->assertEquals(0x14, $colour->getBlue()); $this->assertEquals(1.0, $colour->getAlpha()); - $this->assertInstanceOf(ColourHSL::class, $colour); + $this->assertInstanceOf(ColourHsl::class, $colour); $this->assertFalse($colour->shouldInherit()); $this->assertFalse($colour->isLight()); $this->assertTrue($colour->isDark()); $this->assertEquals('hsl(50deg, 80%, 40%)', $colour); - $colour = new ColourHSL(150, .3, .6, 1.0); + $colour = new ColourHsl(150, .3, .6, 1.0); $this->assertEquals(150, $colour->getHue()); $this->assertEquals(.3, $colour->getSaturation()); $this->assertEquals(.6, $colour->getLightness()); @@ -180,13 +180,13 @@ final class ColourTest extends TestCase { $this->assertEquals(0xB8, $colour->getGreen()); $this->assertEquals(0x99, $colour->getBlue()); $this->assertEquals(1.0, $colour->getAlpha()); - $this->assertInstanceOf(ColourHSL::class, $colour); + $this->assertInstanceOf(ColourHsl::class, $colour); $this->assertFalse($colour->shouldInherit()); $this->assertFalse($colour->isLight()); $this->assertTrue($colour->isDark()); $this->assertEquals('hsl(150deg, 30%, 60%)', $colour); - $colour = new ColourHSL(108, .6, .45, .7); + $colour = new ColourHsl(108, .6, .45, .7); $this->assertEquals(108, $colour->getHue()); $this->assertEquals(.6, $colour->getSaturation()); $this->assertEquals(.45, $colour->getLightness()); @@ -194,13 +194,13 @@ final class ColourTest extends TestCase { $this->assertEquals(0xB8, $colour->getGreen()); $this->assertEquals(0x2E, $colour->getBlue()); $this->assertEquals(.7, $colour->getAlpha()); - $this->assertInstanceOf(ColourHSL::class, $colour); + $this->assertInstanceOf(ColourHsl::class, $colour); $this->assertFalse($colour->shouldInherit()); $this->assertFalse($colour->isLight()); $this->assertTrue($colour->isDark()); $this->assertEquals('hsla(108deg, 60%, 45%, 0.7)', $colour); - $colour = new ColourHSL(0, .8, .5, .25); + $colour = new ColourHsl(0, .8, .5, .25); $this->assertEquals(0, $colour->getHue()); $this->assertEquals(.8, $colour->getSaturation()); $this->assertEquals(.5, $colour->getLightness()); @@ -208,7 +208,7 @@ final class ColourTest extends TestCase { $this->assertEquals(0x1A, $colour->getGreen()); $this->assertEquals(0x1A, $colour->getBlue()); $this->assertEquals(.25, $colour->getAlpha()); - $this->assertInstanceOf(ColourHSL::class, $colour); + $this->assertInstanceOf(ColourHsl::class, $colour); $this->assertFalse($colour->shouldInherit()); $this->assertFalse($colour->isLight()); $this->assertTrue($colour->isDark()); @@ -216,12 +216,12 @@ final class ColourTest extends TestCase { } public function testConvertToHSL(): void { - $colourA = new ColourHSL(50, .8, .4, 1.0); - $colourB = ColourHSL::convert($colourA); + $colourA = new ColourHsl(50, .8, .4, 1.0); + $colourB = ColourHsl::convert($colourA); $this->assertSame($colourA, $colourB); // converting to the same type should passthru $colourA = Colour::none(); - $colourB = ColourHSL::convert($colourA); // converting none to HSL makes very little sense, but you can do it if you want... + $colourB = ColourHsl::convert($colourA); // converting none to HSL makes very little sense, but you can do it if you want... $this->assertEquals(0, $colourB->getHue()); $this->assertEquals(0, $colourB->getSaturation()); $this->assertEquals(0, $colourB->getLightness()); @@ -229,14 +229,14 @@ final class ColourTest extends TestCase { $this->assertEquals(0, $colourB->getGreen()); $this->assertEquals(0, $colourB->getBlue()); $this->assertEquals(1.0, $colourB->getAlpha()); - $this->assertInstanceOf(ColourHSL::class, $colourB); + $this->assertInstanceOf(ColourHsl::class, $colourB); $this->assertFalse($colourB->shouldInherit()); // it does lose the inherit flag, which is intentional $this->assertFalse($colourB->isLight()); $this->assertTrue($colourB->isDark()); $this->assertEquals('hsl(0deg, 0%, 0%)', $colourB); $colourA = new ColourNamed('yellowgreen'); - $colourB = ColourHSL::convert($colourA); + $colourB = ColourHsl::convert($colourA); $this->assertEquals(79.742, $colourB->getHue()); $this->assertEquals(.608, $colourB->getSaturation()); $this->assertEquals(.5, $colourB->getLightness()); @@ -244,14 +244,14 @@ final class ColourTest extends TestCase { $this->assertEquals(0xCD, $colourB->getGreen()); $this->assertEquals(0x32, $colourB->getBlue()); $this->assertEquals(1.0, $colourB->getAlpha()); - $this->assertInstanceOf(ColourHSL::class, $colourB); + $this->assertInstanceOf(ColourHsl::class, $colourB); $this->assertFalse($colourB->shouldInherit()); $this->assertFalse($colourB->isLight()); $this->assertTrue($colourB->isDark()); $this->assertEquals('hsl(79.74deg, 61%, 50%)', $colourB); - $colourA = new ColourRGB(31, 120, 50, 1.0); - $colourB = ColourHSL::convert($colourA); + $colourA = new ColourRgb(31, 120, 50, 1.0); + $colourB = ColourHsl::convert($colourA); $this->assertEquals(132.809, $colourB->getHue()); $this->assertEquals(.589, $colourB->getSaturation()); $this->assertEquals(.296, $colourB->getLightness()); @@ -259,7 +259,7 @@ final class ColourTest extends TestCase { $this->assertEquals(0x78, $colourB->getGreen()); $this->assertEquals(0x32, $colourB->getBlue()); $this->assertEquals(1.0, $colourB->getAlpha()); - $this->assertInstanceOf(ColourHSL::class, $colourB); + $this->assertInstanceOf(ColourHsl::class, $colourB); $this->assertFalse($colourB->shouldInherit()); $this->assertFalse($colourB->isLight()); $this->assertTrue($colourB->isDark()); @@ -278,7 +278,7 @@ final class ColourTest extends TestCase { $this->assertEquals(0xBB, $colour->getGreen()); $this->assertEquals(0xCC, $colour->getBlue()); $this->assertEquals(1.0, $colour->getAlpha()); - $this->assertInstanceOf(ColourRGB::class, $colour); + $this->assertInstanceOf(ColourRgb::class, $colour); $this->assertFalse($colour->shouldInherit()); $this->assertFalse($colour->isLight()); $this->assertTrue($colour->isDark()); @@ -290,7 +290,7 @@ final class ColourTest extends TestCase { $this->assertEquals(0xD7, $colour->getGreen()); $this->assertEquals(0x19, $colour->getBlue()); $this->assertEquals(1.0, $colour->getAlpha()); - $this->assertInstanceOf(ColourRGB::class, $colour); + $this->assertInstanceOf(ColourRgb::class, $colour); $this->assertFalse($colour->shouldInherit()); $this->assertFalse($colour->isLight()); $this->assertTrue($colour->isDark()); @@ -302,7 +302,7 @@ final class ColourTest extends TestCase { $this->assertEquals(0, $colour->getGreen()); $this->assertEquals(0, $colour->getBlue()); $this->assertEquals(1.0, $colour->getAlpha()); - $this->assertInstanceOf(ColourRGB::class, $colour); + $this->assertInstanceOf(ColourRgb::class, $colour); $this->assertFalse($colour->shouldInherit()); $this->assertFalse($colour->isLight()); $this->assertTrue($colour->isDark()); @@ -314,7 +314,7 @@ final class ColourTest extends TestCase { $this->assertEquals(0x53, $colour->getGreen()); $this->assertEquals(0xC4, $colour->getBlue()); $this->assertEquals(1.0, $colour->getAlpha()); - $this->assertInstanceOf(ColourRGB::class, $colour); + $this->assertInstanceOf(ColourRgb::class, $colour); $this->assertFalse($colour->shouldInherit()); $this->assertFalse($colour->isLight()); $this->assertTrue($colour->isDark()); @@ -365,7 +365,7 @@ final class ColourTest extends TestCase { $colour = Colour::parse('#123'); - $this->assertInstanceOf(ColourRGB::class, $colour); + $this->assertInstanceOf(ColourRgb::class, $colour); $this->assertFalse($colour->shouldInherit()); $this->assertEquals('#112233', $colour); $this->assertEquals(1, $colour->getAlpha()); @@ -374,7 +374,7 @@ final class ColourTest extends TestCase { $this->assertEquals(0x33, $colour->getBlue()); $colour = Colour::parse('#3456'); - $this->assertInstanceOf(ColourRGB::class, $colour); + $this->assertInstanceOf(ColourRgb::class, $colour); $this->assertFalse($colour->shouldInherit()); $this->assertEquals('rgba(51, 68, 85, 0.4)', $colour); $this->assertEquals(0.4, $colour->getAlpha()); @@ -383,7 +383,7 @@ final class ColourTest extends TestCase { $this->assertEquals(0x55, $colour->getBlue()); $colour = Colour::parse('#9475b2'); - $this->assertInstanceOf(ColourRGB::class, $colour); + $this->assertInstanceOf(ColourRgb::class, $colour); $this->assertFalse($colour->shouldInherit()); $this->assertEquals('#9475b2', $colour); $this->assertEquals(1, $colour->getAlpha()); @@ -392,7 +392,7 @@ final class ColourTest extends TestCase { $this->assertEquals(0xB2, $colour->getBlue()); $colour = Colour::parse('#8559A5b3'); - $this->assertInstanceOf(ColourRGB::class, $colour); + $this->assertInstanceOf(ColourRgb::class, $colour); $this->assertFalse($colour->shouldInherit()); $this->assertEquals('rgba(133, 89, 165, 0.702)', $colour); $this->assertEquals(0.702, round($colour->getAlpha(), 3)); @@ -402,7 +402,7 @@ final class ColourTest extends TestCase { $colour = Colour::parse('rgb( 17 , 34 , 51)'); - $this->assertInstanceOf(ColourRGB::class, $colour); + $this->assertInstanceOf(ColourRgb::class, $colour); $this->assertFalse($colour->shouldInherit()); $this->assertEquals('#112233', $colour); $this->assertEquals(1, $colour->getAlpha()); @@ -411,7 +411,7 @@ final class ColourTest extends TestCase { $this->assertEquals(0x33, $colour->getBlue()); $colour = Colour::parse('rgba(51 , 68, 85 ,0.4 )'); - $this->assertInstanceOf(ColourRGB::class, $colour); + $this->assertInstanceOf(ColourRgb::class, $colour); $this->assertFalse($colour->shouldInherit()); $this->assertEquals('rgba(51, 68, 85, 0.4)', $colour); $this->assertEquals(0.4, $colour->getAlpha()); @@ -420,7 +420,7 @@ final class ColourTest extends TestCase { $this->assertEquals(0x55, $colour->getBlue()); $colour = Colour::parse('rgba( 148,117,178 )'); - $this->assertInstanceOf(ColourRGB::class, $colour); + $this->assertInstanceOf(ColourRgb::class, $colour); $this->assertFalse($colour->shouldInherit()); $this->assertEquals('#9475b2', $colour); $this->assertEquals(1, $colour->getAlpha()); @@ -429,7 +429,7 @@ final class ColourTest extends TestCase { $this->assertEquals(0xB2, $colour->getBlue()); $colour = Colour::parse('rgb(133 ,89,165,.700)'); - $this->assertInstanceOf(ColourRGB::class, $colour); + $this->assertInstanceOf(ColourRgb::class, $colour); $this->assertFalse($colour->shouldInherit()); $this->assertEquals('rgba(133, 89, 165, 0.7)', $colour); $this->assertEquals(0.7, $colour->getAlpha()); @@ -443,7 +443,7 @@ final class ColourTest extends TestCase { // but should definitely be reviewed in the future $colour = Colour::parse('hsla( 210 , 50 , 13 )'); - $this->assertInstanceOf(ColourHSL::class, $colour); + $this->assertInstanceOf(ColourHsl::class, $colour); $this->assertFalse($colour->shouldInherit()); $this->assertEquals('hsl(210deg, 50%, 13%)', $colour); $this->assertEquals(1, $colour->getAlpha()); @@ -455,7 +455,7 @@ final class ColourTest extends TestCase { $this->assertEquals(50, $colour->getBlue()); $colour = Colour::parse('hsl(210deg ,25%, 27% ,.6)'); - $this->assertInstanceOf(ColourHSL::class, $colour); + $this->assertInstanceOf(ColourHsl::class, $colour); $this->assertFalse($colour->shouldInherit()); $this->assertEquals('hsla(210deg, 25%, 27%, 0.6)', $colour); $this->assertEquals(.6, $colour->getAlpha()); @@ -467,7 +467,7 @@ final class ColourTest extends TestCase { $this->assertEquals(86, $colour->getBlue()); $colour = Colour::parse('hsl(300grad,28%,58)'); - $this->assertInstanceOf(ColourHSL::class, $colour); + $this->assertInstanceOf(ColourHsl::class, $colour); $this->assertFalse($colour->shouldInherit()); $this->assertEquals('hsl(270deg, 28%, 58%)', $colour); $this->assertEquals(1.0, $colour->getAlpha()); @@ -479,7 +479,7 @@ final class ColourTest extends TestCase { $this->assertEquals(178, $colour->getBlue()); $colour = Colour::parse('hsl( 4.799rad ,30 , 50%)'); - $this->assertInstanceOf(ColourHSL::class, $colour); + $this->assertInstanceOf(ColourHsl::class, $colour); $this->assertFalse($colour->shouldInherit()); $this->assertEquals('hsl(275deg, 30%, 50%)', $colour); $this->assertEquals(1.0, $colour->getAlpha()); @@ -491,7 +491,7 @@ final class ColourTest extends TestCase { $this->assertEquals(166, $colour->getBlue()); $colour = Colour::parse('hsl( .775turn , 13,60, .54)'); - $this->assertInstanceOf(ColourHSL::class, $colour); + $this->assertInstanceOf(ColourHsl::class, $colour); $this->assertFalse($colour->shouldInherit()); $this->assertEquals('hsla(279deg, 13%, 60%, 0.54)', $colour); $this->assertEquals(0.54, $colour->getAlpha()); @@ -517,7 +517,7 @@ final class ColourTest extends TestCase { $this->assertFalse($mixed->shouldInherit()); // probably a pretty naive test but its better than nothing - $mixed = Colour::mix(new ColourRGB(0, 100, 50), new ColourRGB(100, 0, 50), 0.5); + $mixed = Colour::mix(new ColourRgb(0, 100, 50), new ColourRgb(100, 0, 50), 0.5); $this->assertEquals(50, $mixed->getRed()); $this->assertEquals(50, $mixed->getGreen()); $this->assertEquals(50, $mixed->getBlue()); diff --git a/tests/CSRFPTest.php b/tests/CsrfTokenTest.php similarity index 90% rename from tests/CSRFPTest.php rename to tests/CsrfTokenTest.php index 6fdf284..9e5729e 100644 --- a/tests/CSRFPTest.php +++ b/tests/CsrfTokenTest.php @@ -1,16 +1,16 @@ createToken(self::TIMESTAMP_1); $token2 = $csrfp2->createToken(self::TIMESTAMP_1); diff --git a/tests/DbToolsTest.php b/tests/DbToolsTest.php index 01ebff5..5a04e77 100644 --- a/tests/DbToolsTest.php +++ b/tests/DbToolsTest.php @@ -1,23 +1,23 @@ assertInstanceOf(NullDbConnection::class, $nullDbConn2); - $maria = new MariaDBBackend; - $sqlite = new SQLiteBackend; + $maria = new MariaDbBackend; + $sqlite = new SqliteBackend; // flashii style misuzu connections details $mci1 = $maria->parseDsn('mariadb://flashii:TiFGzCTxzx0n2HYzmNZpa98j255X7W4B@:unix:/flashii/misuzu?socket=/var/run/mysqld/mysqld.sock&charset=utf8mb4&init=SET SESSION time_zone = \'+00:00\', sql_mode = \'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION\''); diff --git a/tests/IPAddressRangeTest.php b/tests/IpAddressRangeTest.php similarity index 53% rename from tests/IPAddressRangeTest.php rename to tests/IpAddressRangeTest.php index 739720d..4b09d3c 100644 --- a/tests/IPAddressRangeTest.php +++ b/tests/IpAddressRangeTest.php @@ -1,41 +1,41 @@ expectException(InvalidArgumentException::class); - $v0 = IPAddressRange::parse('12.4:424::1/128'); + $v0 = IpAddressRange::parse('12.4:424::1/128'); } public function testToString(): void { - $v4 = IPAddressRange::parse('53.64.123.86/18'); + $v4 = IpAddressRange::parse('53.64.123.86/18'); $this->assertEquals('53.64.123.86/18', (string)$v4); - $v6 = IPAddressRange::parse('abcd:1234::43:211a/86'); + $v6 = IpAddressRange::parse('abcd:1234::43:211a/86'); $this->assertEquals('abcd:1234::43:211a/86', (string)$v6); } public function testMatch(): void { - $v41 = IPAddress::parse('53.64.123.86'); - $v42 = IPAddress::parse('53.64.130.86'); - $v61 = IPAddress::parse('abcd:1234::43:211a'); - $v62 = IPAddress::parse('bbce:1535::73:212a'); + $v41 = IpAddress::parse('53.64.123.86'); + $v42 = IpAddress::parse('53.64.130.86'); + $v61 = IpAddress::parse('abcd:1234::43:211a'); + $v62 = IpAddress::parse('bbce:1535::73:212a'); - $r4 = IPAddressRange::parse('53.64.123.0/22'); - $r6 = IPAddressRange::parse('abcd:1234::43:211a/86'); + $r4 = IpAddressRange::parse('53.64.123.0/22'); + $r6 = IpAddressRange::parse('abcd:1234::43:211a/86'); $this->assertTrue($r4->match($v41)); $this->assertFalse($r4->match($v42)); @@ -51,7 +51,7 @@ final class IPAddressRangeTest extends TestCase { ]; foreach($cidrs as $cidr) { - $obj = IPAddressRange::parse($cidr); + $obj = IpAddressRange::parse($cidr); $ser = serialize($obj); $unser = unserialize($ser); $this->assertTrue($obj->equals($unser)); diff --git a/tests/IPAddressTest.php b/tests/IpAddressTest.php similarity index 71% rename from tests/IPAddressTest.php rename to tests/IpAddressTest.php index fdabc02..33da100 100644 --- a/tests/IPAddressTest.php +++ b/tests/IpAddressTest.php @@ -1,34 +1,34 @@ assertEquals('127.0.0.1', $v4->getAddress()); - $v6 = IPAddress::parse('::1'); + $v6 = IpAddress::parse('::1'); $this->assertEquals('[::1]', $v6->getAddress()); $this->expectException(InvalidArgumentException::class); - $v0 = IPAddress::parse('12.4:424'); + $v0 = IpAddress::parse('12.4:424'); } public function testVersion(): void { - $v4 = IPAddress::parse('123.53.65.34'); + $v4 = IpAddress::parse('123.53.65.34'); $this->assertEquals(4, $v4->getVersion()); $this->assertEquals(4, $v4->getWidth()); $this->assertTrue($v4->isV4()); $this->assertFalse($v4->isV6()); - $v6 = IPAddress::parse('23cd::43c4:2342:acde'); + $v6 = IpAddress::parse('23cd::43c4:2342:acde'); $this->assertEquals(6, $v6->getVersion()); $this->assertEquals(16, $v6->getWidth()); $this->assertTrue($v6->isV6()); @@ -36,18 +36,18 @@ final class IPAddressTest extends TestCase { } public function testToString(): void { - $v4 = IPAddress::parse('53.64.123.86'); + $v4 = IpAddress::parse('53.64.123.86'); $this->assertEquals('53.64.123.86', (string)$v4); - $v6 = IPAddress::parse('abcd:1234::43:211a'); + $v6 = IpAddress::parse('abcd:1234::43:211a'); $this->assertEquals('abcd:1234::43:211a', (string)$v6); } public function testEquals(): void { - $v41 = IPAddress::parse('53.64.123.86'); - $v42 = IPAddress::parse('123.53.65.34'); - $v61 = IPAddress::parse('abcd:1234::43:211a'); - $v62 = IPAddress::parse('23cd::43c4:2342:acde'); + $v41 = IpAddress::parse('53.64.123.86'); + $v42 = IpAddress::parse('123.53.65.34'); + $v61 = IpAddress::parse('abcd:1234::43:211a'); + $v62 = IpAddress::parse('23cd::43c4:2342:acde'); $this->assertTrue($v41->equals($v41)); $this->assertFalse($v42->equals($v41)); @@ -64,7 +64,7 @@ final class IPAddressTest extends TestCase { ]; foreach($addrs as $addr) - $this->assertEquals(json_encode($addr), json_encode(IPAddress::parse($addr))); + $this->assertEquals(json_encode($addr), json_encode(IpAddress::parse($addr))); } public function testSerializable(): void { @@ -76,7 +76,7 @@ final class IPAddressTest extends TestCase { ]; foreach($addrs as $addr) { - $obj = IPAddress::parse($addr); + $obj = IpAddress::parse($addr); $ser = serialize($obj); $unser = unserialize($ser); $this->assertTrue($obj->equals($unser)); diff --git a/tests/XDateTimeTest.php b/tests/XDateTimeTest.php index 66aef88..62cc66c 100644 --- a/tests/XDateTimeTest.php +++ b/tests/XDateTimeTest.php @@ -1,7 +1,7 @@ assertEquals(XDateTime::toISO8601String($dateTime), '2013-01-27T23:14:44+01:00'); + $this->assertEquals(XDateTime::toIso8601String($dateTime), '2013-01-27T23:14:44+01:00'); $this->assertEquals(XDateTime::toCookieString($dateTime), 'Sunday, 27-Jan-2013 23:14:44 CET'); - $this->assertEquals(XDateTime::toRFC822String($dateTime), 'Sun, 27 Jan 13 23:14:44 +0100'); + $this->assertEquals(XDateTime::toRfc822String($dateTime), 'Sun, 27 Jan 13 23:14:44 +0100'); $dateTime = $dateTime->setTimezone(new DateTimeZone('UTC')); - $this->assertEquals(XDateTime::toISO8601String($dateTime), '2013-01-27T22:14:44+00:00'); + $this->assertEquals(XDateTime::toIso8601String($dateTime), '2013-01-27T22:14:44+00:00'); $this->assertEquals(XDateTime::toCookieString($dateTime), 'Sunday, 27-Jan-2013 22:14:44 UTC'); - $this->assertEquals(XDateTime::toRFC822String($dateTime), 'Sun, 27 Jan 13 22:14:44 +0000'); + $this->assertEquals(XDateTime::toRfc822String($dateTime), 'Sun, 27 Jan 13 22:14:44 +0000'); - $this->assertEquals(XDateTime::toISO8601String(1359324884), '2013-01-27T22:14:44+00:00'); + $this->assertEquals(XDateTime::toIso8601String(1359324884), '2013-01-27T22:14:44+00:00'); $this->assertEquals(XDateTime::toCookieString(1359324884), 'Sunday, 27-Jan-2013 22:14:44 GMT'); - $this->assertEquals(XDateTime::toRFC822String(1359324884), 'Sun, 27 Jan 13 22:14:44 +0000'); + $this->assertEquals(XDateTime::toRfc822String(1359324884), 'Sun, 27 Jan 13 22:14:44 +0000'); - $this->assertEquals(XDateTime::toISO8601String('January 27th 2013 22:14:44 UTC'), '2013-01-27T22:14:44+00:00'); + $this->assertEquals(XDateTime::toIso8601String('January 27th 2013 22:14:44 UTC'), '2013-01-27T22:14:44+00:00'); $this->assertEquals(XDateTime::toCookieString('January 27th 2013 22:14:44 UTC'), 'Sunday, 27-Jan-2013 22:14:44 GMT'); - $this->assertEquals(XDateTime::toRFC822String('January 27th 2013 22:14:44 UTC'), 'Sun, 27 Jan 13 22:14:44 +0000'); + $this->assertEquals(XDateTime::toRfc822String('January 27th 2013 22:14:44 UTC'), 'Sun, 27 Jan 13 22:14:44 +0000'); } public function testCompare(): void {