Skip to content

Commit

Permalink
Clean up examples
Browse files Browse the repository at this point in the history
  • Loading branch information
rybakit committed Apr 4, 2022
1 parent b055683 commit abc1958
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 25 deletions.
21 changes: 0 additions & 21 deletions examples/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,27 +54,6 @@ function ensure_extension(string $name) : void
requirement_exit('PHP extension "%s" is required to run "%s"', $name, $_SERVER['SCRIPT_FILENAME']);
}

function ensure_class(string $className, string $requireMessage = '') : void
{
if (class_exists($className)) {
return;
}

$errorMessage = $requireMessage ?: sprintf('Class "%s" is required', $className);

requirement_exit('%s to run "%s"', $errorMessage, $_SERVER['SCRIPT_FILENAME']);
}

function ensure_pure_packer(Client $client) : void
{
$packer = $client->getHandler()->getPacker();
if ($packer instanceof PurePacker) {
return;
}

requirement_exit('Client needs to be configured to use pure packer to run "%s"', $_SERVER['SCRIPT_FILENAME']);
}

function requirement_exit(string $message, ...$args) : void
{
echo "Unfulfilled requirement:\n";
Expand Down
1 change: 0 additions & 1 deletion examples/custom_error/example.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

$client = create_client();
ensure_server_version_at_least('2.4.1', $client);
ensure_pure_packer($client);

// CustomErrorMiddleware::fromNamespace('App') will map Lua errors to "App\<lua_error.custom_type>" classes.
// For more options, see the CustomErrorMiddleware class source.
Expand Down
1 change: 0 additions & 1 deletion examples/user_defined_type/example_decimal.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
$client = create_client();
ensure_server_version_at_least('2.3', $client);
ensure_extension('decimal');
ensure_pure_packer($client);

$spaceName = 'example';

Expand Down
2 changes: 0 additions & 2 deletions examples/user_defined_type/example_uuid.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

$client = create_client();
ensure_server_version_at_least('2.4', $client);
ensure_class(Uuid::class, 'Composer package "symfony/uid" is required');
ensure_pure_packer($client);

$spaceName = 'example';

Expand Down

0 comments on commit abc1958

Please sign in to comment.