Skip to content

Commit

Permalink
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
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
1 change: 0 additions & 1 deletion .gitignore

This file was deleted.

29 changes: 29 additions & 0 deletions class.element.php
@@ -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>";
}

}

0 comments on commit d5d32d9

Please sign in to comment.