Skip to content

Commit

Permalink
Breaking compatibility, but remove non-autoloadable shortcuts.php
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesread committed Aug 13, 2023
1 parent 4d485a3 commit 8112e92
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 88 deletions.
73 changes: 73 additions & 0 deletions src/main/php/libAllure/Shortcuts.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?php

namespace libAllure;

abstract class Shortcuts
{
public static function san(): \libAllure\Sanitizer
{
return \libAllure\Sanitizer::getInstance();
}

public static function db(): \libAllure\DatabaseFactory
{
return \libAllure\DatabaseFactory::getInstance();
}

public static function stmt($sql)
{
$stmt = db()->prepare($sql);

Check failure on line 19 in src/main/php/libAllure/Shortcuts.php

View workflow job for this annotation

GitHub Actions / build

Function db not found.

return $stmt;
}

public static function stmtPrepExec($sql)
{
$stmt = stmt($sql);

Check failure on line 26 in src/main/php/libAllure/Shortcuts.php

View workflow job for this annotation

GitHub Actions / build

Function stmt not found.
$stmt->prepare();
$stmt->execute();

return $stmt;
}

public static function filterStrings()
{
$ret = array();
$san = \libAllure\Sanitizer::getInstance();
$san->filterAllowUndefined = false;

foreach (func_get_args() as $argname) {
$ret[$argname] = $san->filterString($argname);
}

return $ret;
}

public static function filterUints()
{
$ret = array();
$san = \libAllure\Sanitizer::getInstance();
$san->filterAllowUndefined = false;

foreach (func_get_args() as $argname) {
$ret[$argname] = $san->filterUint($argname);
}

return $ret;
}

public static function vde()
{
if (!headers_sent()) {
header('Content-Type: text/plain');
}

foreach (func_get_args() as $i => $arg) {
echo "Arg " . $i . ":\n";
var_dump($arg);
echo "\n\n";
}

exit;
}
}
88 changes: 0 additions & 88 deletions src/main/php/libAllure/util/shortcuts.php

This file was deleted.

0 comments on commit 8112e92

Please sign in to comment.