This repository has been archived by the owner on Jun 20, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from JustBlackBird/untagged_container
Add untagged container
- Loading branch information
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
/** | ||
* @module Canteen\HTML5 | ||
*/ | ||
namespace Canteen\HTML5 | ||
{ | ||
/** | ||
* Represents a set of HTML tags without a wrapper. | ||
* Do not initiate this class directly, use the `html()` function: | ||
* | ||
* $div = html('container'); | ||
* | ||
* @class UntaggedContainer | ||
* @extends Node | ||
* @constructor | ||
* @param {Node|Array} [children=null] The collection of children or single child | ||
*/ | ||
class Fragment extends NodeContainer | ||
{ | ||
public function __construct($children = null) | ||
{ | ||
parent::__construct('fragment', $children, null); | ||
} | ||
|
||
/** | ||
* Write to HTML | ||
* @method __toString | ||
* @return {String} The string representation of this HTML node | ||
*/ | ||
public function __toString() | ||
{ | ||
$buffer = ''; | ||
foreach($this->getChildren() as $child) | ||
{ | ||
$buffer .= $child->__toString(); | ||
} | ||
|
||
return $buffer; | ||
} | ||
} | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters