prepare

@param array $attrs

@return  void
356889
public function prepare(&$attrs)
    {
        parent::prepare($attrs);

        $attrs['max'] = $this->getAttribute('max');
        $attrs['min'] = $this->getAttribute('min');
        $attrs['step'] = $this->getAttribute('step');
        $attrs['patten'] = $this->getAttribute('pattern');
    }
17900
private function gedcomStartHandler(array $attrs): void
    {
        if ($this->process_gedcoms > 0) {
            $this->process_gedcoms++;

            return;
        }

        $tag       = $attrs['id'];
        $tag       = str_replace('@fact', $this->fact, $tag);
        $tags      = explode(':', $tag);
        $newgedrec = '';
        if (count($tags) < 2) {
            $tmp       = GedcomRecord::getInstance($attrs['id'], $this->tree);
            $newgedrec = $tmp ? $tmp->privatizeGedcom(Auth::accessLevel($this->tree)) : '';
        }
        if (empty($newgedrec)) {
            $tgedrec   = $this->gedrec;
            $newgedrec = '';
            foreach ($tags as $tag) {
                if (preg_match('/\$(.+)/', $tag, $match)) {
                    if (isset($this->vars[$match[1]]['gedcom'])) {
                        $newgedrec = $this->vars[$match[1]]['gedcom'];
                    } else {
                        $tmp       = GedcomRecord::getInstance($match[1], $this->tree);
                        $newgedrec = $tmp ? $tmp->privatizeGedcom(Auth::accessLevel($this->tree)) : '';
                    }
                } else {
                    if (preg_match('/@(.+)/', $tag, $match)) {
                        $gmatch = [];
                        if (preg_match("/\d $match[1] @([^@]+)@/", $tgedrec, $gmatch)) {
                            $tmp       = GedcomRecord::getInstance($gmatch[1], $this->tree);
                            $newgedrec = $tmp ? $tmp->privatizeGedcom(Auth::accessLevel($this->tree)) : '';
                            $tgedrec   = $newgedrec;
                        } else {
                            $newgedrec = '';
                            break;
                        }
                    } else {
                        $temp      = explode(' ', trim($tgedrec));
                        $level     = 1 + (int) $temp[0];
                        $newgedrec = Functions::getSubRecord($level, "$level $tag", $tgedrec);
                        $tgedrec   = $newgedrec;
                    }
                }
            }
        }
        if (!empty($newgedrec)) {
            $this->gedrec_stack[] = [$this->gedrec, $this->fact, $this->desc];
            $this->gedrec         = $newgedrec;
            if (preg_match("/(\d+) (_?[A-Z0-9]+) (.*)/", $this->gedrec, $match)) {
                $this->fact = $match[2];
                $this->desc = trim($match[3]);
            }
        } else {
            $this->process_gedcoms++;
        }
    }
599521
private function footnoteStartHandler(array $attrs): void
    {
        $id = '';
        if (preg_match('/[0-9] (.+) @(.+)@/', $this->gedrec, $match)) {
            $id = $match[2];
        }
        $record = GedcomRecord::getInstance($id, $this->tree);
        if ($record && $record->canShow()) {
            $this->print_data_stack[] = $this->print_data;
            $this->print_data         = true;
            $style                    = '';
            if (!empty($attrs['style'])) {
                $style = $attrs['style'];
            }
            $this->footnote_element = $this->current_element;
            $this->current_element  = $this->report_root->createFootnote($style);
        } else {
            $this->print_data       = false;
            $this->process_footnote = false;
        }
    }
246257
protected function inputStartHandler(array $attrs): void
    {
        $this->text  = '';
        $this->input = [
            'name'    => $attrs['name'] ?? '',
            'type'    => $attrs['type'] ?? '',
            'lookup'  => $attrs['lookup'] ?? '',
            'options' => $attrs['options'] ?? '',
            'default' => '',
            'value'   => '',
        ];

        if (isset($attrs['default'])) {
            if ($attrs['default'] === 'NOW') {
                $this->input['default'] = Carbon::now()->format('d M Y');
            } else {
                $match = [];
                if (preg_match('/NOW([+\-]\d+)/', $attrs['default'], $match) > 0) {
                    $this->input['default'] = Carbon::now()->addDays((int) $match[1])->format('d M Y');
                } else {
                    $this->input['default'] = $attrs['default'];
                }
            }
        } elseif ($attrs['name'] === 'pageSize') {
            $this->input['default'] = app(LocaleInterface::class)->territory()->paperSize();
        }
    }
1088916
public function setAttributes(array $attributes)
    {
        foreach ($attributes as $name => $value) {
            $this->bag->setAttribute($this->prefix . $name, $value);
        }
    }
1003076
public function assign($attrs)
    {
        foreach ($attrs as $key => $val) {
            if (property_exists($this, $key)) {
                $this->$key = $val;
            }
        }
    }
738985
public function startElement($name, $attrs)
    {
        $tmp = new ElementHandler($this->parser, $this, $this->configurator, null, null, $this->target);
        $tmp->init($name, $attrs);
    }
66601
private function gedcomValueStartHandler(array $attrs): void
    {
        $id    = '';
        $match = [];
        if (preg_match('/0 @(.+)@/', $this->gedrec, $match)) {
            $id = $match[1];
        }

        if (isset($attrs['newline']) && $attrs['newline'] === '1') {
            $useBreak = '1';
        } else {
            $useBreak = '0';
        }

        $tag = $attrs['tag'];
        if (!empty($tag)) {
            if ($tag === '@desc') {
                $value = $this->desc;
                $value = trim($value);
                $this->current_element->addText($value);
            }
            if ($tag === '@id') {
                $this->current_element->addText($id);
            } else {
                $tag = str_replace('@fact', $this->fact, $tag);
                if (empty($attrs['level'])) {
                    $temp  = explode(' ', trim($this->gedrec));
                    $level = $temp[0];
                    if ($level == 0) {
                        $level++;
                    }
                } else {
                    $level = $attrs['level'];
                }
                $tags  = preg_split('/[: ]/', $tag);
                $value = $this->getGedcomValue($tag, $level, $this->gedrec);
                switch (end($tags)) {
                    case 'DATE':
                        $tmp   = new Date($value);
                        $value = $tmp->display();
                        break;
                    case 'PLAC':
                        $tmp   = new Place($value, $this->tree);
                        $value = $tmp->shortName();
                        break;
                }
                if ($useBreak === '1') {
                    // Insert <br> when multiple dates exist.
                    // This works around a TCPDF bug that incorrectly wraps RTL dates on LTR pages
                    $value = str_replace('(', '<br>(', $value);
                    $value = str_replace('<span dir="ltr"><br>', '<br><span dir="ltr">', $value);
                    $value = str_replace('<span dir="rtl"><br>', '<br><span dir="rtl">', $value);
                    if (substr($value, 0, 4) === '<br>') {
                        $value = substr($value, 4);
                    }
                }
                $tmp = explode(':', $tag);
                if (in_array(end($tmp), [
                    'NOTE',
                    'TEXT',
                ])) {
                    $value = Filter::formatText($value, $this->tree); // We'll strip HTML in addText()
                }

                if (!empty($attrs['truncate'])) {
                    $value = strip_tags($value);
                    $value = Str::limit($value, $attrs['truncate'], I18N::translate('…'));
                }
                $this->current_element->addText($value);
            }
        }
    }
758315
protected function prepareAttributes()
    {

        // initialize the values that has to be updated
        $updatedAt = date('Y-m-d H:i:s');
        $path = $this->getValue(ColumnKeys::PATH);

        // prepare and return the array with the updated values
        return array(
            MemberNames::PATH           => $path,
            MemberNames::UPDATED_AT     => $updatedAt
        );
    }
720627
public function setAttrArray(array $attributes)
    {
        foreach ($attributes as $attribute => $value) {
            $this->setAttr($attribute, $value);
        }
    }
1066523
private function prepareAttributes(array $attributes)
    {
        $attributes = array_merge(
            ['class' => 'g-recaptcha', 'data-sitekey' => $this->siteKey],
            array_filter($attributes)
        );

        self::checkDataAttribute($attributes, 'data-type', ['image', 'audio'], 'image');
        self::checkDataAttribute($attributes, 'data-theme', ['light', 'dark'], 'light');
        self::checkDataAttribute($attributes, 'data-size', ['normal', 'compact', 'invisible'], 'normal');
        self::checkDataAttribute($attributes, 'data-badge', ['bottomright', 'bottomleft', 'inline'], 'bottomright');

        return $attributes;
    }
501335
public function prepare(&$attrs)
    {
        $attrs['type'] = $this->type ?: 'text';
        $attrs['name'] = $this->getFieldName();
        $attrs['id'] = $this->getAttribute('id', $this->getId());
        $attrs['class'] = $this->getAttribute('class');
        $attrs['placeholder'] = $this->getAttribute('placeholder');
        $attrs['size'] = $this->getAttribute('size');
        $attrs['maxlength'] = $this->getAttribute('maxlength');
        $attrs['readonly'] = $this->getAttribute('readonly');
        $attrs['disabled'] = $this->getAttribute('disabled');
        $attrs['autofocus'] = $this->getAttribute('autofocus');
        $attrs['autocomplete'] = $this->getAttribute('autocomplete');
        $attrs['form'] = $this->getAttribute('form');
        $attrs['formenctype'] = $this->getAttribute('formenctype');
        $attrs['formmethod'] = $this->getAttribute('formmethod');
        $attrs['formnovalidate'] = $this->getAttribute('formnovalidate');
        $attrs['formtarget'] = $this->getAttribute('formtarget');
        $attrs['onchange'] = $this->getAttribute('onchange');
        $attrs['onfocus'] = $this->getAttribute('onfocus');
        $attrs['onblur'] = $this->getAttribute('onblur');
        $attrs['value'] = $this->escape($this->getValue());
        $attrs['list'] = $this->getAttribute('list', count($this->options) ? $this->getId() . '-list' : null);

        $attrs['required'] = $this->required;
    }
1053470
private function textBoxStartHandler(array $attrs): void
    {
        // string Background color code
        $bgcolor = '';
        if (!empty($attrs['bgcolor'])) {
            $bgcolor = $attrs['bgcolor'];
        }

        // boolean Wether or not fill the background color
        $fill = true;
        if (isset($attrs['fill'])) {
            if ($attrs['fill'] === '0') {
                $fill = false;
            } elseif ($attrs['fill'] === '1') {
                $fill = true;
            }
        }

        // var boolean Whether or not a border should be printed around this box. 0 = no border, 1 = border. Default is 0
        $border = false;
        if (isset($attrs['border'])) {
            if ($attrs['border'] === '1') {
                $border = true;
            } elseif ($attrs['border'] === '0') {
                $border = false;
            }
        }

        // int The starting height of this cell. If the text wraps the height will automatically be adjusted
        $height = 0;
        if (!empty($attrs['height'])) {
            $height = (int) $attrs['height'];
        }
        // int Setting the width to 0 will make it the width from the current location to the margin
        $width = 0;
        if (!empty($attrs['width'])) {
            $width = (int) $attrs['width'];
        }

        // mixed Position the left corner of this box on the page. The default is the current position.
        $left = ReportBaseElement::CURRENT_POSITION;
        if (isset($attrs['left'])) {
            if ($attrs['left'] === '.') {
                $left = ReportBaseElement::CURRENT_POSITION;
            } elseif (!empty($attrs['left'])) {
                $left = (int) $attrs['left'];
            } elseif ($attrs['left'] === '0') {
                $left = 0;
            }
        }
        // mixed Position the top corner of this box on the page. the default is the current position
        $top = ReportBaseElement::CURRENT_POSITION;
        if (isset($attrs['top'])) {
            if ($attrs['top'] === '.') {
                $top = ReportBaseElement::CURRENT_POSITION;
            } elseif (!empty($attrs['top'])) {
                $top = (int) $attrs['top'];
            } elseif ($attrs['top'] === '0') {
                $top = 0;
            }
        }
        // boolean After this box is finished rendering, should the next section of text start immediately after the this box or should it start on a new line under this box. 0 = no new line, 1 = force new line. Default is 0
        $newline = false;
        if (isset($attrs['newline'])) {
            if ($attrs['newline'] === '1') {
                $newline = true;
            } elseif ($attrs['newline'] === '0') {
                $newline = false;
            }
        }
        // boolean
        $pagecheck = true;
        if (isset($attrs['pagecheck'])) {
            if ($attrs['pagecheck'] === '0') {
                $pagecheck = false;
            } elseif ($attrs['pagecheck'] === '1') {
                $pagecheck = true;
            }
        }
        // boolean Cell padding
        $padding = true;
        if (isset($attrs['padding'])) {
            if ($attrs['padding'] === '0') {
                $padding = false;
            } elseif ($attrs['padding'] === '1') {
                $padding = true;
            }
        }
        // boolean Reset this box Height
        $reseth = false;
        if (isset($attrs['reseth'])) {
            if ($attrs['reseth'] === '1') {
                $reseth = true;
            } elseif ($attrs['reseth'] === '0') {
                $reseth = false;
            }
        }

        // string Style of rendering
        $style = '';

        $this->print_data_stack[] = $this->print_data;
        $this->print_data         = false;

        $this->wt_report_stack[] = $this->wt_report;
        $this->wt_report         = $this->report_root->createTextBox(
            $width,
            $height,
            $border,
            $bgcolor,
            $newline,
            $left,
            $top,
            $pagecheck,
            $style,
            $fill,
            $padding,
            $reseth
        );
    }
1371417
protected function reportStartHandler(array $attrs): void
    {
        $this->data['access'] = $attrs['access'] ?? Auth::PRIV_PRIVATE;

        $this->data['icon'] = $attrs['icon'] ?? '';
    }
724855
public function startElement($name, $attrs)
    {
        $eh = new ElementHandler(
            $this->parser,
            $this,
            $this->configurator,
            $this->child,
            $this->childWrapper,
            $this->target
        );
        $eh->init($name, $attrs);
    }
403520
protected function addValidAttributes( $attrs ) {
        foreach( $attrs as $attr ) {
            //add if string
            if( is_string( $attr ) ) {
                $this->validAttributes[] = $attr;
            }
        }
    }
415019
private function prepare(): void
  {
    $this->addClass(static::$class);

    if (static::$responsiveMediaQuery!==null && $this->getAttribute('id')===null)
    {
      $this->setAttrId(Html::getAutoId());
    }
  }