public static function table($params = array()) {

        if( !is_array($params) )
        {
            throw new \InvalidArgumentException("Arguments is not a Array". print_r($params, true));
        }

        $o = "<table ";
        $o .= (isset($params['class'])) ? " class='{$params['class']}'" : '';
        $o .= ">";

        $o .="<thead>";
        $o .="<tr>";
        if (isset($params['thead']) && is_array($params['thead'])) {
            foreach ($params['thead'] as $key => $value) {

                if (isset($params['th']) && $params['th'] == $key) {
                    $o .= "<th>" . $value . "</th>";
                } else {
                    $o .= "<th>" . $value . "</th>";
                }
            }
        }
        $o .= " </tr>";
        $o .= "</thead>";

        $o .= "<tfoot>";
        $o .="<tr>";
        if (isset($params['tfoot']) && is_array($params['tfoot'])) {
            foreach ($params['tfoot'] as $key => $value) {
                if (isset($params['td']) && $params['td'] == $key) {
                    $o .= "<td>" . $value . "</td>";
                } else {
                    $o .= "<td>" . $value . "</td>";
                }
            }
        }
        $o .= " </tr>";
        $o .= "</tfoot>";

        $o .= "<tbody>";
        $o .="<tr>";
        if (isset($params['tbody']) && is_array($params['tbody'])) {
            foreach ($params['tbody'] as $key => $value) {
                if (isset($params['td']) && $params['td'] == $key) {
                    $o .= "<td>" . $value . "</td>";
                } else {
                    $o .= "<td>" . $value . "</td>";
                }
            }
        }
        $o .= " </tr>";
        $o .= "</tbody>";
        $o .= "</table>";
        return $o;
    }
public static function table($params = array()) {

        if( !is_array($params) )
        {
            throw new \InvalidArgumentException("Arguments is not a Array". print_r($params, true));
        }

        $o = "<table ";
        $o .= (isset($params['class'])) ? " class='{$params['class']}'" : '';
        $o .= ">";

        $o .="<thead>";
        $o .="<tr>";
        if (isset($params['thead']) && is_array($params['thead'])) {
            foreach ($params['thead'] as $key => $value) {

                if (isset($params['th']) && $params['th'] == $key) {
                    $o .= "<th>" . $value . "</th>";
                } else {
                    $o .= "<th>" . $value . "</th>";
                }
            }
        }
        $o .= " </tr>";
        $o .= "</thead>";

        $o .= "<tfoot>";
        $o .="<tr>";
        if (isset($params['tfoot']) && is_array($params['tfoot'])) {
            foreach ($params['tfoot'] as $key => $value) {
                if (isset($params['td']) && $params['td'] == $key) {
                    $o .= "<td>" . $value . "</td>";
                } else {
                    $o .= "<td>" . $value . "</td>";
                }
            }
        }
        $o .= " </tr>";
        $o .= "</tfoot>";

        $o .= "<tbody>";
        $o .="<tr>";
        if (isset($params['tbody']) && is_array($params['tbody'])) {
            foreach ($params['tbody'] as $key => $value) {
                if (isset($params['td']) && $params['td'] == $key) {
                    $o .= "<td>" . $value . "</td>";
                } else {
                    $o .= "<td>" . $value . "</td>";
                }
            }
        }
        $o .= " </tr>";
        $o .= "</tbody>";
        $o .= "</table>";
        return $o;
    }
public static function table ( $ params = array ( ) ) { if ( ! is_array ( $ params ) ) { throw new \ InvalidArgumentException ( "Arguments is not a Array" . print_r ( $ params , true ) ) ; } $ o = "<table " ; $ o .= ( isset ( $ params [ 'class' ] ) ) ? " class='{$params['class']}'" : '' ; $ o .= ">" ; $ o .= "<thead>" ; $ o .= "<tr>" ; if ( isset ( $ params [ 'thead' ] ) && is_array ( $ params [ 'thead' ] ) ) { foreach ( $ params [ 'thead' ] as $ key => $ value ) { if ( isset ( $ params [ 'th' ] ) && $ params [ 'th' ] == $ key ) { $ o .= "<th>" . $ value . "</th>" ; } else { $ o .= "<th>" . $ value . "</th>" ; } } } $ o .= " </tr>" ; $ o .= "</thead>" ; $ o .= "<tfoot>" ; $ o .= "<tr>" ; if ( isset ( $ params [ 'tfoot' ] ) && is_array ( $ params [ 'tfoot' ] ) ) { foreach ( $ params [ 'tfoot' ] as $ key => $ value ) { if ( isset ( $ params [ 'td' ] ) && $ params [ 'td' ] == $ key ) { $ o .= "<td>" . $ value . "</td>" ; } else { $ o .= "<td>" . $ value . "</td>" ; } } } $ o .= " </tr>" ; $ o .= "</tfoot>" ; $ o .= "<tbody>" ; $ o .= "<tr>" ; if ( isset ( $ params [ 'tbody' ] ) && is_array ( $ params [ 'tbody' ] ) ) { foreach ( $ params [ 'tbody' ] as $ key => $ value ) { if ( isset ( $ params [ 'td' ] ) && $ params [ 'td' ] == $ key ) { $ o .= "<td>" . $ value . "</td>" ; } else { $ o .= "<td>" . $ value . "</td>" ; } } } $ o .= " </tr>" ; $ o .= "</tbody>" ; $ o .= "</table>" ; return $ o ; }
This method returns a table element given the params for settings

@param [ 'thead' => [ 'a', 'b' ], 'tbody' => [ 'ax', 'bx'] , 'class' =>  'xxxxxx', ] ;

@return  string
This method returns a table element given the params for settings