From 54681a89274101665363fed4790f028e275453ff Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Tue, 11 Mar 2008 15:16:51 -0400 Subject: [PATCH] In BSPrinterElementTable::__construct(), we can now on-the-fly create Label elements from just strings to save us some code * CHANGES * PrinterElementTable.php: (BSPrinterElementTable::__construct): If the child is not an instance of BSPrinterAbstract, make it into a Label --- CHANGES | 3 +++ PrinterElementTable.php | 7 +++++++ 2 files changed, 10 insertions(+) create mode 100644 CHANGES diff --git a/CHANGES b/CHANGES new file mode 100644 index 0000000..5e66e52 --- /dev/null +++ b/CHANGES @@ -0,0 +1,3 @@ +3.1.0 +=================== +- Change: BSPrinterElementTable:__construct() can now take straight strings and convert them into BSPrinterElementLabel's \ No newline at end of file diff --git a/PrinterElementTable.php b/PrinterElementTable.php index 17e635b..2fe58b0 100644 --- a/PrinterElementTable.php +++ b/PrinterElementTable.php @@ -63,6 +63,13 @@ class BSPrinterElementTable extends BSPrinterAbstract $childs = func_get_args(); if (is_array($childs)) { + foreach ($childs as $key => $value) + { + if (!($value instanceof BSPrinterAbstract)) + { + $childs[$key] = BSPrinterElementLabel::make($value); + } + } $this->children = $childs; } } -- 2.22.5