99
1010namespace  MaplePHP \Output \Dom ;
1111
12- class  Document
12+ use  MaplePHP \Output \Interfaces \DocumentInterface ;
13+ use  MaplePHP \Output \Interfaces \ElementInterface ;
14+ 
15+ class  Document implements  DocumentInterface
1316{
1417    public  const  TAG_NO_ENDING  = [
1518        "meta " ,
@@ -30,6 +33,10 @@ class Document
3033    private  $ elem
3134    private  static  $ inst
3235
36+     /** 
37+      * Will output get 
38+      * @return string 
39+      */ 
3340    public  function  __toString (): string 
3441    {
3542        return  $ this get ();
@@ -39,7 +46,7 @@ public function __toString(): string
3946     * Get get Dom/document (Will only trigger execute once per instance) 
4047     * @return string 
4148     */ 
42-     public  function  get ()
49+     public  function  get ():  string 
4350    {
4451        if  (is_null ($ this html )) {
4552            $ this execute ();
@@ -52,7 +59,7 @@ public function get()
5259     * @param  string $key DOM access key 
5360     * @return self 
5461     */ 
55-     public  static  function  dom (string  $ key
62+     public  static  function  dom (string  $ key:  self 
5663    {
5764        if  (empty (self ::$ inst$ key
5865            self ::$ inst$ keynew  self ();
@@ -65,9 +72,9 @@ public static function dom(string $key)
6572     * @param  string       $tag     HTML tag (without brackets) 
6673     * @param  string       $key     Bind tag to key 
6774     * @param  bool|boolean $prepend Prepend instead of append 
68-      * @return self  
75+      * @return ElementInterface  
6976     */ 
70-     public  function  bindTag (string  $ tagstring  $ keybool  $ prependfalse )
77+     public  function  bindTag (string  $ tagstring  $ keybool  $ prependfalse ):  ElementInterface 
7178    {
7279        if  ($ prepend
7380            $ this elem  = $ this createPrepend ($ tagnull , $ key
@@ -81,9 +88,9 @@ public function bindTag(string $tag, string $key, bool $prepend = false)
8188     * Create (append) element 
8289     * @param  string $element HTML tag (without brackets) 
8390     * @param  string $value   add value to tag 
84-      * @return self  
91+      * @return ElementInterface  
8592     */ 
86-     public  function  create ($ element$ valuenull , ?string  $ bindnull )
93+     public  function  create ($ element$ valuenull , ?string  $ bindnull ):  ElementInterface 
8794    {
8895        $ instnew  Element ($ element$ value
8996
@@ -100,9 +107,9 @@ public function create($element, $value = null, ?string $bind = null)
100107     * Prepend element first 
101108     * @param  string $element HTML tag (without brackets) 
102109     * @param  string $value   add value to tag 
103-      * @return self  
110+      * @return ElementInterface  
104111     */ 
105-     public  function  createPrepend (string  $ elementstring  $ valuenull , ?string  $ bindnull )
112+     public  function  createPrepend (string  $ elementstring  $ valuenull , ?string  $ bindnull ):  ElementInterface 
106113    {
107114        $ instnew  Element ($ element$ value
108115        if  (is_null ($ this elements )) {
@@ -120,9 +127,9 @@ public function createPrepend(string $element, ?string $value = null, ?string $b
120127
121128    /** 
122129     * Get one element from key 
123-      * @return Element |null 
130+      * @return ElementInterface |null 
124131     */ 
125-     public  function  getElement (string  $ keyElement 
132+     public  function  getElement (string  $ keyElementInterface 
126133    {
127134        return  ($ this elements [$ keynull );
128135    }
@@ -131,7 +138,7 @@ public function getElement(string $key): ?Element
131138     * Get all elements 
132139     * @return array 
133140     */ 
134-     public  function  getElements ()
141+     public  function  getElements ():  array 
135142    {
136143        return  $ this elements ;
137144    }
@@ -151,7 +158,7 @@ public function getTag(string $key): ?string
151158     * @param  callable|null $call Can be used to manipulate element within feed 
152159     * @return string 
153160     */ 
154-     public  function  execute (?callable  $ callnull )
161+     public  function  execute (?callable  $ callnull ):  string 
155162    {
156163        $ this html  = "" ;
157164        if  (is_null ($ this elements )) {
0 commit comments