diff --git a/Makefile b/Makefile index 39b9cf1..7838652 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ default: tests lint test: tests +phpunit: tests tests: composer run-script test @@ -11,7 +12,10 @@ phpcs: ./vendor/bin/phpcs phpstan: - ./vendor/bin/phpstan analyse --level 1 src/main/php/libAllure/ + ./vendor/bin/phpstan analyse --level 5 src/main/php/libAllure/ + +docs: + doxygen .PHONY: test tests default lint diff --git a/src/main/php/libAllure/.ErrorHandler.php.swo b/src/main/php/libAllure/.ErrorHandler.php.swo deleted file mode 100644 index 05f0919..0000000 Binary files a/src/main/php/libAllure/.ErrorHandler.php.swo and /dev/null differ diff --git a/src/main/php/libAllure/Database.php b/src/main/php/libAllure/Database.php index 26a3574..71f44b1 100644 --- a/src/main/php/libAllure/Database.php +++ b/src/main/php/libAllure/Database.php @@ -43,13 +43,10 @@ public function __construct($dsn, $username, $password) //$this->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, true); } - public function prepareSelectById($table, $id) + public function prepareSelectById($table, $id, ...$fields) { - $args = func_get_args(); - $table = array_shift($args); - $id = intval(array_shift($args)); + $fields = implode(', ', array_merge(array('id'), $fields)); - $fields = implode(array_merge(array('id'), $args), ', '); $sql = "SELECT {$fields} FROM {$table} WHERE id = :id"; $stmt = $this->prepare($sql); $stmt->bindValue(':id', $id); diff --git a/src/main/php/libAllure/ElementButton.php b/src/main/php/libAllure/ElementButton.php index 6f285af..e2b4c72 100644 --- a/src/main/php/libAllure/ElementButton.php +++ b/src/main/php/libAllure/ElementButton.php @@ -16,6 +16,5 @@ protected function afterConstruct() public function render() { return ''; - return ''; } } diff --git a/src/main/php/libAllure/ElementNumeric.php b/src/main/php/libAllure/ElementNumeric.php index dc0cf27..c5843c4 100644 --- a/src/main/php/libAllure/ElementNumeric.php +++ b/src/main/php/libAllure/ElementNumeric.php @@ -6,7 +6,6 @@ class ElementNumeric extends ElementInput { private $allowNegative = false; private $allowFloatingPoint = false; - private $allowNonDenery = false; private $maximum = PHP_INT_MAX; private $minimum = 0; @@ -21,10 +20,6 @@ public function setAllowFloatingPoint($allowFloatingPoint) $this->allowFloatingPoint = $allowFloatingPoint; } - public function setAllowNonDenery($allowNonDenary) - { - } - public function setBounds($minimum, $maximum) { if (!is_numeric($minimum) || !is_numeric($maximum)) { diff --git a/src/main/php/libAllure/Form.php b/src/main/php/libAllure/Form.php index 9e66fcf..13946ab 100644 --- a/src/main/php/libAllure/Form.php +++ b/src/main/php/libAllure/Form.php @@ -43,13 +43,11 @@ abstract class Form { public static $registeredForms = array(); - private $rules = array(); protected $elements = array(); public $scripts = array(); private $name; private $submitter; private $title = ''; - private $generalError; private $action; protected $enctype = 'multipart/form-data'; @@ -261,11 +259,6 @@ private function getElementName($element) } } - public function setGeneralError($generalError) - { - $this->generalError = $generalError; - } - public static function strToForm($s) { if (class_exists($s)) { diff --git a/src/main/php/libAllure/Sanitizer.php b/src/main/php/libAllure/Sanitizer.php index 92e602a..ffcaa08 100644 --- a/src/main/php/libAllure/Sanitizer.php +++ b/src/main/php/libAllure/Sanitizer.php @@ -51,7 +51,6 @@ class Sanitizer public const FORMAT_FOR_ALL = 64; private $inputSource = self::INPUT_REQUEST; - private $variableNamePrefixes = array ('form'); private static $instance; diff --git a/src/main/php/libAllure/Scheduler.php b/src/main/php/libAllure/Scheduler.php index 4bed4bf..188d512 100644 --- a/src/main/php/libAllure/Scheduler.php +++ b/src/main/php/libAllure/Scheduler.php @@ -23,12 +23,10 @@ class Scheduler { private $db; - private $startTime; public function __construct(\libAllure\Database $db) { $this->db = $db; - $this->startTime = time(); } public function executeOverdueJobs() diff --git a/src/main/php/libAllure/Session.php b/src/main/php/libAllure/Session.php index 4cbc429..b07b5c6 100644 --- a/src/main/php/libAllure/Session.php +++ b/src/main/php/libAllure/Session.php @@ -33,9 +33,6 @@ class Session public static $cookieSecure = false; public static $cookieHttpOnly = true; - // static copy of $_SESSION['user'] - private static $user; - protected function __construct() { } diff --git a/src/main/php/libAllure/Template.php b/src/main/php/libAllure/Template.php index cd19f9c..dbf4c71 100644 --- a/src/main/php/libAllure/Template.php +++ b/src/main/php/libAllure/Template.php @@ -98,7 +98,7 @@ public function boolToString($test, $onTrue = "Yes", $onFalse = "No", $onNull = { if ($test == null) { return $onNull; - } elseif ($test) { + } elseif ($test == true) { return $onTrue; } else { return $onFalse;