tag : DRAW
mode : OPEN

@param  array $param
@return boolean
501031
protected function _tag_open_DRAW($param)
    {
        if ($this->_isForOneLine) {
            return false;
        }
        if (!is_null($this->debug)) {
            $this->debug->addStep('DRAW', true);
        }

        $this->parsingCss->save();
        $this->parsingCss->analyse('draw', $param);
        $this->parsingCss->fontSet();

        $alignObject = null;
        if ($this->parsingCss->value['margin-auto']) {
            $alignObject = 'center';
        }

        $overW = $this->parsingCss->value['width'];
        $overH = $this->parsingCss->value['height'];
        $this->parsingCss->value['old_maxX'] = $this->_maxX;
        $this->parsingCss->value['old_maxY'] = $this->_maxY;
        $this->parsingCss->value['old_maxH'] = $this->_maxH;

        $w = $this->parsingCss->value['width'];
        $h = $this->parsingCss->value['height'];

        if (!$this->parsingCss->value['position']) {
            if ($w < ($this->pdf->getW() - $this->pdf->getlMargin()-$this->pdf->getrMargin()) &&
                $this->pdf->GetX() + $w>=($this->pdf->getW() - $this->pdf->getrMargin())
                ) {
                $this->_tag_open_BR(array());
            }

            if (($h < ($this->pdf->getH() - $this->pdf->gettMargin()-$this->pdf->getbMargin())) &&
                    ($this->pdf->GetY() + $h>=($this->pdf->getH() - $this->pdf->getbMargin())) &&
                    !$this->_isInOverflow
                ) {
                $this->_setNewPage();
            }

            $old = $this->parsingCss->getOldValues();
            $parentWidth = $old['width'] ? $old['width'] : $this->pdf->getW() - $this->pdf->getlMargin() - $this->pdf->getrMargin();

            if ($parentWidth>$w) {
                if ($alignObject === 'center') {
                    $this->pdf->SetX($this->pdf->GetX() + ($parentWidth-$w)*0.5);
                } elseif ($alignObject === 'right') {
                    $this->pdf->SetX($this->pdf->GetX() + $parentWidth-$w);
                }
            }

            $this->parsingCss->setPosition();
        } else {
            $old = $this->parsingCss->getOldValues();
            $parentWidth = $old['width'] ? $old['width'] : $this->pdf->getW() - $this->pdf->getlMargin() - $this->pdf->getrMargin();

            if ($parentWidth>$w) {
                if ($alignObject === 'center') {
                    $this->pdf->SetX($this->pdf->GetX() + ($parentWidth-$w)*0.5);
                } elseif ($alignObject === 'right') {
                    $this->pdf->SetX($this->pdf->GetX() + $parentWidth-$w);
                }
            }

            $this->parsingCss->setPosition();
            $this->_saveMax();
            $this->_maxX = 0;
            $this->_maxY = 0;
            $this->_maxH = 0;
            $this->_maxE = 0;
        }

        $this->_drawRectangle(
            $this->parsingCss->value['x'],
            $this->parsingCss->value['y'],
            $this->parsingCss->value['width'],
            $this->parsingCss->value['height'],
            $this->parsingCss->value['border'],
            $this->parsingCss->value['padding'],
            0,
            $this->parsingCss->value['background']
        );

        $marge = array();
        $marge['l'] = $this->parsingCss->value['border']['l']['width'];
        $marge['r'] = $this->parsingCss->value['border']['r']['width'];
        $marge['t'] = $this->parsingCss->value['border']['t']['width'];
        $marge['b'] = $this->parsingCss->value['border']['b']['width'];

        $this->parsingCss->value['width'] -= $marge['l']+$marge['r'];
        $this->parsingCss->value['height']-= $marge['t']+$marge['b'];

        $overW-= $marge['l']+$marge['r'];
        $overH-= $marge['t']+$marge['b'];

        // clipping to draw only in the size opf the DRAW tag
        $this->pdf->clippingPathStart(
            $this->parsingCss->value['x']+$marge['l'],
            $this->parsingCss->value['y']+$marge['t'],
            $this->parsingCss->value['width'],
            $this->parsingCss->value['height']
        );

        // left and right of the DRAW tag
        $mL = $this->parsingCss->value['x']+$marge['l'];
        $mR = $this->pdf->getW() - $mL - $overW;

        // position of the DRAW tag
        $x = $this->parsingCss->value['x']+$marge['l'];
        $y = $this->parsingCss->value['y']+$marge['t'];

        // prepare the drawing area
        $this->_saveMargin($mL, 0, $mR);
        $this->pdf->SetXY($x, $y);

        $this->svgDrawer->startDrawing(
            array(
                'x' => $x,
                'y' => $y,
                'w' => $overW,
                'h' => $overH,
            )
        );

        return true;
    }
172054
protected function checkParam($param, $type)
    {
        $type = $this->getTypeRegexp($type);

        return (bool) preg_match("#^{$type}$#", $param);
    }
370912
protected function _tag_open_TFOOT($param)
    {
        if ($this->_isForOneLine) {
            return false;
        }

        $this->parsingCss->save();
        $this->parsingCss->analyse('tfoot', $param);
        $this->parsingCss->setPosition();
        $this->parsingCss->fontSet();

        // if we are in a sub part, save the number of the first TR in the tfoot
        if ($this->_subPart) {
            self::$_tables[$param['num']]['tfoot']['tr'][0] = self::$_tables[$param['num']]['tr_curr'];
            self::$_tables[$param['num']]['tfoot']['code'] = array();

            $amountHtmlCodes = count($this->parsingHtml->code);
            for ($pos=$this->_tempPos; $pos<$amountHtmlCodes; $pos++) {
                $action = clone $this->parsingHtml->code[$pos];
                if (strtolower($action->getName()) === 'tfoot') {
                    $action->setName('tfoot_sub');
                }
                self::$_tables[$param['num']]['tfoot']['code'][] = $action;
                if (strtolower($action->getName()) === 'tfoot_sub' && $action->isClose()) {
                    break;
                }
            }
        } else {
            $level = $this->parsingHtml->getLevel($this->_parsePos);
            $this->_parsePos+= count($level);
            self::$_tables[$param['num']]['tr_curr']+= count(self::$_tables[$param['num']]['tfoot']['tr']);
        }

        return true;
    }
237841
protected function _tag_close_PAGE($param)
    {
        if ($this->_isForOneLine) {
            return false;
        }

        $this->_maxH = 0;

        $this->parsingCss->load();
        $this->parsingCss->fontSet();

        if (!is_null($this->debug)) {
            $this->debug->addStep('PAGE '.$this->_page, false);
        }

        return true;
    }
1136387
function isFunctionParam( $param )
    {
        $isFunction = false;
        if( is_array( $param) && isset( $param['_function'] ) )
            $isFunction = true;

        return $isFunction;
    }
612104
protected function _tag_close_TR($param)
    {
        if ($this->_isForOneLine) {
            return false;
        }

        $this->_maxH = 0;

        $this->parsingCss->load();
        $this->parsingCss->fontSet();

        // if we are not in a sub HTML
        if (!$this->_subPart) {

            // Y of the current line
            $ty=null;
            $nbTrCurrs = count(self::$_tables[$param['num']]['cases'][self::$_tables[$param['num']]['tr_curr']-1]);
            for ($ii=0; $ii<$nbTrCurrs; $ii++) {
                if (self::$_tables[$param['num']]['cases'][self::$_tables[$param['num']]['tr_curr']-1][$ii]['rowspan'] == 1) {
                    $ty = self::$_tables[$param['num']]['cases'][self::$_tables[$param['num']]['tr_curr']-1][$ii]['h'];
                }
            }

            // new position
            self::$_tables[$param['num']]['td_x'] = self::$_tables[$param['num']]['curr_x']+self::$_tables[$param['num']]['marge']['l'];
            self::$_tables[$param['num']]['td_y']+= $ty;
            self::$_tables[$param['num']]['new_page'] = false;
        } else {
            self::$_tables[$param['num']]['corr_y']++;
        }

        return true;
    }
1294718
protected function _tag_open_PAGE_FOOTER_SUB($param)
    {
        if ($this->_isForOneLine) {
            return false;
        }

        // save the current stat
        $this->_subSTATES = array();
        $this->_subSTATES['x']    = $this->pdf->GetX();
        $this->_subSTATES['y']    = $this->pdf->GetY();
        $this->_subSTATES['s']    = $this->parsingCss->value;
        $this->_subSTATES['t']    = $this->parsingCss->table;
        $this->_subSTATES['ml']    = $this->_margeLeft;
        $this->_subSTATES['mr']    = $this->_margeRight;
        $this->_subSTATES['mt']    = $this->_margeTop;
        $this->_subSTATES['mb']    = $this->_margeBottom;
        $this->_subSTATES['mp']    = $this->_pageMarges;

        // new stat for the footer
        $this->_pageMarges  = array();
        $this->_margeLeft   = $this->_defaultLeft;
        $this->_margeRight  = $this->_defaultRight;
        $this->_margeTop    = $this->_defaultTop;
        $this->_margeBottom = $this->_defaultBottom;
        $this->pdf->SetMargins($this->_margeLeft, $this->_margeTop, $this->_margeRight);
        $this->pdf->SetAutoPageBreak(false, $this->_margeBottom);
        $this->pdf->SetXY($this->_defaultLeft, $this->_defaultTop);

        $this->parsingCss->initStyle();
        $this->parsingCss->resetStyle();
        $this->parsingCss->value['width']    = $this->pdf->getW() - $this->_defaultLeft - $this->_defaultRight;
        $this->parsingCss->table                = array();

        // we create a sub HTML2PFDF, and we execute on it the content of the footer, to get the height of it
        $sub = $this->createSubHTML();
        $sub->parsingHtml->code = $this->parsingHtml->getLevel($this->_parsePos);
        $sub->_makeHTMLcode();
        $this->pdf->SetY($this->pdf->getH() - $sub->_maxY - $this->_defaultBottom - 0.01);
        $this->_destroySubHTML($sub);

        $this->parsingCss->save();
        $this->parsingCss->analyse('page_footer_sub', $param);
        $this->parsingCss->setPosition();
        $this->parsingCss->fontSet();
        $this->_setNewPositionForNewLine();

        return true;
    }
1188784
private function mode($params) {

		$mode = 'params';

	 	if(count($params) > 0 && 0 === count(array_filter(array_keys($params), 'is_string'))) {
	 		$mode = 'bind';
	 	}

	 	return $mode;
	}
125421
public function one($param = true){
        $this->isAr = true;
        if($this->isPretreatment){
            self::$Pre = $this->bindSql();
            if(!$param) return self::$Pre->queryString;
            return $this->dbh->pone($this->bindSql());
        }
        $bind = $this->bindSql();
        if(!$param) return $this->PrintSQL();
        $this->initialize();
        return $bind->one();
    }
1027056
protected function _tag_open_PRE($param, $other = 'pre')
    {
        if ($other === 'pre' && $this->_maxH) {
            $this->_tag_open_BR(array());
        }

        $this->parsingCss->save();
        $this->parsingCss->value['font-family'] = 'courier';
        $this->parsingCss->analyse($other, $param);
        $this->parsingCss->setPosition();
        $this->parsingCss->fontSet();

        if ($other === 'pre') {
            return $this->_tag_open_DIV($param, $other);
        }

        return true;
    }
280695
protected function getParam($param)
    {
        $params = $this->getParams();
        if (! isset($params[$param])) {
            return false;
        }
        return $params[$param];
    }
564953
public function getCardProvider($param)
    {
        $this->flushState();
        $isValidProvider = CheckoutApi_Client_Validation_GW3::isProvider($param);
        $uri = $this->getUriProvider().'/cards';
        $hasError = false;
        if(!$isValidProvider)
        {
            $hasError = true;
            $this->throwException('Please provide a valid provider id',array('param'=>$param));
        }

        if(!$hasError){
            $uri = "{$uri}/{$param['providerId']}";
        }

        return $this->request( $uri ,$param,!$hasError);
    }
957219
public static function prepareParams(array $param){

        $fillable = static::getInstance()->getFillables();

        foreach($param as $key => $value){
            if(!in_array($key, $fillable)){
                unset($param[$key]);
            } elseif(!$value){
                unset($param[$key]);
            }
        }

        return $param;
    }
44907
protected function _tag_open_PAGE_HEADER_SUB($param)
    {
        if ($this->_isForOneLine) {
            return false;
        }

        // save the current stat
        $this->_subSTATES = array();
        $this->_subSTATES['x']  = $this->pdf->GetX();
        $this->_subSTATES['y']  = $this->pdf->GetY();
        $this->_subSTATES['s']  = $this->parsingCss->value;
        $this->_subSTATES['t']  = $this->parsingCss->table;
        $this->_subSTATES['ml'] = $this->_margeLeft;
        $this->_subSTATES['mr'] = $this->_margeRight;
        $this->_subSTATES['mt'] = $this->_margeTop;
        $this->_subSTATES['mb'] = $this->_margeBottom;
        $this->_subSTATES['mp'] = $this->_pageMarges;

        // new stat for the header
        $this->_pageMarges = array();
        $this->_margeLeft    = $this->_defaultLeft;
        $this->_margeRight   = $this->_defaultRight;
        $this->_margeTop     = $this->_defaultTop;
        $this->_margeBottom  = $this->_defaultBottom;
        $this->pdf->SetMargins($this->_margeLeft, $this->_margeTop, $this->_margeRight);
        $this->pdf->SetAutoPageBreak(false, $this->_margeBottom);
        $this->pdf->SetXY($this->_defaultLeft, $this->_defaultTop);

        $this->parsingCss->initStyle();
        $this->parsingCss->resetStyle();
        $this->parsingCss->value['width'] = $this->pdf->getW() - $this->_defaultLeft - $this->_defaultRight;
        $this->parsingCss->table = array();

        $this->parsingCss->save();
        $this->parsingCss->analyse('page_header_sub', $param);
        $this->parsingCss->setPosition();
        $this->parsingCss->fontSet();
        $this->_setNewPositionForNewLine();
        return true;
    }
1349176
protected function _tag_open_WRITE($param)
    {
        $fill = ($this->parsingCss->value['background']['color'] !== null && $this->parsingCss->value['background']['image'] === null);
        if (in_array($this->parsingCss->value['id_tag'], array('fieldset', 'legend', 'div', 'table', 'tr', 'td', 'th'))) {
            $fill = false;
        }

        // get the text to write
        $txt = $param['txt'];

        if ($this->_isAfterFloat) {
            $txt = ltrim($txt);
            $this->_isAfterFloat = false;
        }

        $txt = str_replace('[[page_nb]]', $this->pdf->getMyAliasNbPages(), $txt);
        $txt = str_replace('[[page_cu]]', $this->pdf->getMyNumPage($this->_page), $txt);

        if ($this->parsingCss->value['text-transform'] !== 'none') {
            if ($this->parsingCss->value['text-transform'] === 'capitalize') {
                $txt = mb_convert_case($txt, MB_CASE_TITLE, $this->_encoding);
            } elseif ($this->parsingCss->value['text-transform'] === 'uppercase') {
                $txt = mb_convert_case($txt, MB_CASE_UPPER, $this->_encoding);
            } elseif ($this->parsingCss->value['text-transform'] === 'lowercase') {
                $txt = mb_convert_case($txt, MB_CASE_LOWER, $this->_encoding);
            }
        }

        // size of the text
        $h  = 1.08*$this->parsingCss->value['font-size'];
        $dh = $h*$this->parsingCss->value['mini-decal'];
        $lh = $this->parsingCss->getLineHeight();

        // identify the align
        $align = 'L';
        if ($this->parsingCss->value['text-align'] === 'li_right') {
            $w = $this->parsingCss->value['width'];
            $align = 'R';
        }

        // calculate the width of each words, and of all the sentence
        $w = 0;
        $words = explode(' ', $txt);
        foreach ($words as $k => $word) {
            $words[$k] = array($word, $this->pdf->GetStringWidth($word));
            $w+= $words[$k][1];
        }
        $space = $this->pdf->GetStringWidth(' ');
        $w+= $space*(count($words)-1);

        // position in the text
        $currPos = 0;

        // the bigger width of the text, after automatic break line
        $maxX = 0;

        // position of the text
        $x = $this->pdf->GetX();
        $y = $this->pdf->GetY();
        $dy = $this->_getElementY($lh);

        // margins
        list($left, $right) = $this->_getMargins($y);

        // number of lines after automatic break line
        $nb = 0;

        // while we have words, and the text does not fit on the line => we cut the sentence
        while ($x+$w>$right && $x<$right+$space && count($words)) {
            // adding words 1 by 1 to fit on the line
            $i=0;
            $old = array('', 0);
            $str = $words[0];
            $add = false;
            while (($x+$str[1])<$right) {
                $i++;
                $add = true;

                array_shift($words);
                $old = $str;

                if (!count($words)) {
                    break;
                }
                $str[0].= ' '.$words[0][0];
                $str[1]+= $space+$words[0][1];
            }
            $str = $old;

            // if nothing fits on the line, and if the first word does not fit on the line => the word is too long, we put it
            if ($i == 0 && (($left+$words[0][1])>=$right)) {
                $str = $words[0];
                array_shift($words);
                $i++;
                $add = true;
            }
            $currPos+= ($currPos ? 1 : 0)+strlen($str[0]);

            // write the extract sentence that fit on the page
            $wc = ($align === 'L' ? $str[1] : $this->parsingCss->value['width']);
            if ($right - $left<$wc) {
                $wc = $right - $left;
            }

            if (strlen($str[0])) {
                $this->pdf->SetXY($this->pdf->GetX(), $y+$dh+$dy);
                $this->pdf->Cell($wc, $h, $str[0], 0, 0, $align, $fill, $this->_isInLink);
                $this->pdf->SetXY($this->pdf->GetX(), $y);
            }
            $this->_maxH = max($this->_maxH, $lh);

            // max width
            $maxX = max($maxX, $this->pdf->GetX());

            // new position and new width for the "while"
            $w-= $str[1];
            $y = $this->pdf->GetY();
            $x = $this->pdf->GetX();
            $dy = $this->_getElementY($lh);

            // if we have again words to write
            if (count($words)) {
                // remove the space at the end
                if ($add) {
                    $w-= $space;
                }

                // if we don't add any word, and if the first word is empty => useless space to skip
                if (!$add && $words[0][0] === '') {
                    array_shift($words);
                }

                // if it is just to calculate for one line => adding the number of words
                if ($this->_isForOneLine) {
                    $this->_maxE+= $i;
                    $this->_maxX = max($this->_maxX, $maxX);
                    return null;
                }

                // automatic line break
                $this->_tag_open_BR(array('style' => ''), $currPos);

                // new position
                $y = $this->pdf->GetY();
                $x = $this->pdf->GetX();
                $dy = $this->_getElementY($lh);

                // if the next line does  not fit on the page => new page
                if ($y + $h>=$this->pdf->getH() - $this->pdf->getbMargin()) {
                    if (!$this->_isInOverflow && !$this->_isInFooter) {
                        $this->_setNewPage(null, '', null, $currPos);
                        $y = $this->pdf->GetY();
                        $x = $this->pdf->GetX();
                        $dy = $this->_getElementY($lh);
                    }
                }

                // if more than X line => error
                $nb++;
                if ($nb > $this->_sentenceMaxLines) {
                    $txt = '';
                    foreach ($words as $k => $word) {
                        $txt.= ($k ? ' ' : '').$word[0];
                    }
                    $e = new LongSentenceException(
                        'The current sentence takes more than '.$this->_sentenceMaxLines.' lines is the current box'
                    );
                    $e->setSentence($txt);
                    $e->setWidthBox($right-$left);
                    $e->setLength($w);
                    throw $e;
                }

                // new margins for the new line
                list($left, $right) = $this->_getMargins($y);
            }
        }

        // if we have words after automatic cut, it is because they fit on the line => we write the text
        if (count($words)) {
            $txt = '';
            foreach ($words as $k => $word) {
                $txt.= ($k ? ' ' : '').$word[0];
            }
            $w+= $this->pdf->getWordSpacing()*(count($words));
            $this->pdf->SetXY($this->pdf->GetX(), $y+$dh+$dy);
            $this->pdf->Cell(($align === 'L' ? $w : $this->parsingCss->value['width']), $h, $txt, 0, 0, $align, $fill, $this->_isInLink);
            $this->pdf->SetXY($this->pdf->GetX(), $y);
            $this->_maxH = max($this->_maxH, $lh);
            $this->_maxE+= count($words);
        }

        $maxX = max($maxX, $this->pdf->GetX());
        $maxY = $this->pdf->GetY()+$h;

        $this->_maxX = max($this->_maxX, $maxX);
        $this->_maxY = max($this->_maxY, $maxY);

        return true;
    }
61243
public function acceptWebP($param = 'accept_webp')
    {
        return is_int(stripos($this->server->get('HTTP_ACCEPT'), 'webp')) || (bool)$this->get($param) == true;
    }
665982
public function has($param)
        {
            if ($param instanceof Container) {
                $id = (int) $param->id;
            } elseif (is_integer($param)) {
                $id = $param;
            }

            if (isset($id) && isset($this->_items[$id])) {
                return true;
            }

            return false;
        }