/ LJCPHPCodeDoc / LJCTextBuilderLib / LJCTextBuilder / AddIndent


Parameters
$increment - _ParamSummary_

Returns

The current indent count.

Syntax

PHP
public function AddIndent($increment = 1): int

Changes the IndentCount by the provided value.

Example

PHP
 $tb = new LJCTextBuilder();
 
 // Example Method:
 // The builder keeps track of the current number of indents.
 // Adds 1 indent by default.
 $tb->AddIndent();
 
 // Adds text without modification.
 $tb->AddText("This text is not indented.");
 
 // Starts the text with a newline if the builder already has text, param
 // allowNewLine = true and builder text does not end with a newline.
 // The text begins with the current indent string if param
 // addIndent = true.
 // Defaults: addIndent = true, allowNewLine = true.
 $tb->Text("This text is indented.");
 
 // No Indent
 $tb->Text("Not indented.", addIndent: false);
 
 // Do not start a newline.
 $tb->AddText(" No start with newline.");
 $result = hb->ToString();
 
 // result:
 // This text is not indented.
 //   This text is indented.
 // Not indented. No start with newline.

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.