From 59658ab85cb5fcbf819c3f600af61916f265f30b Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 12 Jan 2008 15:29:54 -0800 Subject: [PATCH] Setting up the fluent interface for all of the printer classes --- PrinterElement.php | 8 ++++++++ PrinterRootElement.php | 3 +++ PrinterRootElementForm.php | 6 ++++++ PrinterRootElementTable.php | 9 +++++++++ PrinterTableElement.php | 6 ++++++ 5 files changed, 32 insertions(+) diff --git a/PrinterElement.php b/PrinterElement.php index e28bbe9..ab229ca 100644 --- a/PrinterElement.php +++ b/PrinterElement.php @@ -65,19 +65,27 @@ abstract class BSPrinterElement * Sets the CSS class to use. Use ":swap:" to alternate * * @param string CSS class + * + * @return fluent interface */ public function setCssClass($class) { $this->cssClass = $class; + return $this; } // ################################################################### /** * Sets the style information + * + * @param array Style attributes + * + * @return fluent interface */ public function setStyle(Array $attributes) { $this->style = $attributes; + return $this; } // ################################################################### diff --git a/PrinterRootElement.php b/PrinterRootElement.php index e4e77dc..de30f39 100644 --- a/PrinterRootElement.php +++ b/PrinterRootElement.php @@ -57,10 +57,13 @@ abstract class BSPrinterRootElement extends BSPrinterElement * Adds a child node to the element * * @param BSPrinterElement A child element + * + * @return fluent interface */ public function addChild(BSPrinterElement $child) { $this->children[] = $child; + return $this; } } diff --git a/PrinterRootElementForm.php b/PrinterRootElementForm.php index 9bc2ce1..f818d1b 100644 --- a/PrinterRootElementForm.php +++ b/PrinterRootElementForm.php @@ -92,10 +92,13 @@ class BSPrinterRootElementForm extends BSPrinterRootElement * Should this form be used for upload? * * @param bool Upload? + * + * @return fluent interface */ public function setUpload($upload) { $this->upload = $upload; + return $this; } // ################################################################### @@ -103,10 +106,13 @@ class BSPrinterRootElementForm extends BSPrinterRootElement * Adds a table row into the child list * * @param BSPrinterElement Table element + * + * @return fluent interface */ public function addChild(BSPrinterElement $tr) { $this->children[] = $tr; + return $this; } // ################################################################### diff --git a/PrinterRootElementTable.php b/PrinterRootElementTable.php index 47bdade..d1aedbc 100644 --- a/PrinterRootElementTable.php +++ b/PrinterRootElementTable.php @@ -84,6 +84,8 @@ class BSPrinterRootElementTable extends BSPrinterRootElement * Adds a table row into the child list * * @param BSPrinterTableElement Table element + * + * @return fluent interface */ public function addChild(BSPrinterElement $tr) { @@ -92,6 +94,7 @@ class BSPrinterRootElementTable extends BSPrinterRootElement throw new Exception('BSPrinterRootElementTable::addChild() only accepts BSPrinterTableElement objects as children'); } $this->children[] = $tr; + return $this; } // ################################################################### @@ -100,10 +103,13 @@ class BSPrinterRootElementTable extends BSPrinterRootElement * considered a child, but it goes before all other child elemends * * @param BSPrinterTableElement Child element + * + * @return fluent interface */ public function addHeadingChild(BSPrinterTableElement $tr) { $this->headers[] = $tr; + return $this; } // ################################################################### @@ -111,10 +117,13 @@ class BSPrinterRootElementTable extends BSPrinterRootElement * Sets the width of the table * * @param string Width value + * + * @return fluent interface */ public function setWidth($width) { $this->width = $width; + return $this; } // ################################################################### diff --git a/PrinterTableElement.php b/PrinterTableElement.php index ee65946..adffe90 100644 --- a/PrinterTableElement.php +++ b/PrinterTableElement.php @@ -319,10 +319,13 @@ class BSPrinterTableElement extends BSPrinterElement * Adds a child node to the element * * @param BSPrinterElement A child element + * + * @return fluent interface */ public function addChild(BSPrinterElement $child) { $this->children[] = $child; + return $this; } // ################################################################### @@ -331,6 +334,8 @@ class BSPrinterTableElement extends BSPrinterElement * elements accordingly * * @param integer Column count + * + * @return fluent interface */ public function setColumnNumber($cols) { @@ -339,6 +344,7 @@ class BSPrinterTableElement extends BSPrinterElement throw new Exception('You need to have at least ' . $this->numberOfColumns() . ' columns'); } $this->colspan = $cols; + return $this; } // ################################################################### -- 2.22.5