Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
that gitignore was really mean, brian
- Loading branch information
Timothy Morris
committed
Feb 27, 2017
1 parent
4d70b61
commit d5d32d9
Showing
2 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,29 @@ | ||
<?php | ||
|
||
class Element { | ||
|
||
public $tag; | ||
public $content; | ||
public $attrs; | ||
|
||
public function __construct($t, $c, $a = []) { | ||
$this->tag = $t; | ||
$this->content = $c; | ||
$this->attrs = $a; | ||
} | ||
|
||
public function setAttribute($name, $value) { | ||
$this->attrs[$name] = $value; | ||
} | ||
|
||
public function __toString() { | ||
|
||
$attr_string = ''; | ||
foreach($this->attrs as $name => $value) { | ||
$attr_string .= "{$name}='{$value}' "; | ||
} | ||
|
||
return "<$this->tag $attr_string>$this->content</$this->tag>"; | ||
} | ||
|
||
} |