Create a button.

@param $key
@param $val
@return Elements
769425
protected function button($key, $val)
    {
        $extra = [
            'type' => strtolower(__FUNCTION__),
        ];

        return $this->composeElement($key, $val, $extra);
    }
670828
public function data(string $key=null, $val=null)
    {
        $doc_hash = spl_object_hash($this->document);

        if ($val !== null) { // set data for all nodes
            if (!isset(self::$node_data[$doc_hash])) {
                self::$node_data[$doc_hash] = array();
            }
            foreach ($this->getElements() as $node) {
                if (!isset(self::$node_data[$doc_hash][self::getElementId($node)])) {
                    self::$node_data[$doc_hash][self::getElementId($node)] = (object) array();
                }
                self::$node_data[$doc_hash][self::getElementId($node)]->$key = $val;
            }
            return $this;
        }

        if ($node = $this->getFirstElmNode()) { // get data for first element
            if (isset(self::$node_data[$doc_hash]) && isset(self::$node_data[$doc_hash][self::getElementId($node)])) {
                if ($key === null) {
                    return self::$node_data[$doc_hash][self::getElementId($node)];
                } elseif (isset(self::$node_data[$doc_hash][self::getElementId($node)]->$key)) {
                    return self::$node_data[$doc_hash][self::getElementId($node)]->$key;
                }
            }
            if ($key === null) { // object with all data
                $data = array();
                foreach ($node->attributes as $attr) {
                    if (strpos($attr->nodeName, 'data-') === 0) {
                        $val = $attr->nodeValue[0] === '{' ? json_decode($attr->nodeValue) : $attr->nodeValue;
                        $data[substr($attr->nodeName, 5)] = $val;
                    }
                }
                return (object) $data;
            }
            if ($data = $node->getAttribute('data-'.$key)) {
                $val = $data[0] === '{' ? json_decode($data) : $data;
                return $val;
            }
        }
    }
70181
public function pressKey($key)
    {
        $this->executor->execute(DriverCommand::SEND_KEYS_TO_ACTIVE_ELEMENT, [
            'value' => [(string) $key],
        ]);

        return $this;
    }
1144920
public function setDefaultData($key, $val = null)
    {
        if(is_array($key))
        {
            foreach($key as $k=>$v)
            {
                $this->setDefaultData($k, $v);
            }
        }
        else
        {
            $this->defaultData[$key] = $val;
        }

        return $this;
    }
901968
public function addAttrib($key, $val)
    {
        $this->_attribs = array_merge(array($key => $val), $this->_attribs);
    }
1104008
public function addValue(string $key, $val, string $comment = '') : TomlBuilder
    {
        $this->currentKey = $key;
        $this->exceptionIfKeyEmpty($key);
        $this->addKey($key);

        if (!$this->isUnquotedKey($key)) {
            $key = '"'.$key.'"';
        }

        $line = "{$key} = {$this->dumpValue($val)}";

        if (!empty($comment)) {
            $line .= ' '.$this->dumpComment($comment);
        }

        $this->append($line, true);

        return $this;
    }
876571
public function increment($key, $val = 1)
    {
        $this->lock = true;
        $v = $this->get($key);
        if (is_int($v)) {
            return $this->update($key, $v + abs(intval($val)));
        } else {
            $this->set($key, 1);
            return 1;
        }
    }
797951
public function emit($val, $key = null)
    {
        $this->_result[$key === null ? $this->_counter : $key] = $val;
        $this->_counter++;
    }
962892
public function setAttribute($key, $val)
    {
        try {
            return $this->_stmt->setAttribute($key, $val);
        } catch (PDOException $e) {
            // require_once 'Zend/Db/Statement/Exception.php';
            throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
        }
    }
1320223
public function increment($key, $val = 1)
    {
        return $this->hash($key)->incrBy($key, abs(intval($val)));
    }
1059889
protected function setSessionData(string $key, $val)
    {
        if (method_exists($this->getSession(), 'put')) {
            return $this->getSession()->put($key, $val);
        } elseif (method_exists($this->getSession(), 'set')) {
            return $this->getSession()->set($key, $val);
        } elseif (method_exists($this->getSession(), 'write')) {
            return $this->getSession()->write($key, $val);
        }

        return false;
    }
729620
public function assign($key, $val = null)
    {
        if (is_array($key)) {
            $this->args = array_merge($this->args, $key);
        } else {
            $this->args[$key] = $val;
        }
        return $this;
    }
227411
public function assignByRef($key, &$val = null)
    {
        if (is_array($key)) {
            foreach ($key as $k => &$v) {
                $this->args[$k] = $v;
            }
        } else {
            $this->args[$key] = $val;
        }
        return $this;
    }
187059
public static function create($key)
    {
        // Ignore arrays and objects
        if (is_object($key) or is_array($key)) {
            $key = '';
        }

        $key_string = strval($key);

        $key = new self;
        $key->raw = $key_string;

        $keys = explode('.', $key_string);

        foreach ($keys as $value) {
            $key->push($value);
        }

        $key->rewind();

        return $key;
    }
328870
public function pushLog($key, $val)
    {
        if (! $this->enable || ! (\is_string($key) || is_numeric($key))) {
            return;
        }

        $key = urlencode($key);
        $cid = Coroutine::tid();
        if (\is_array($val)) {
            $this->pushlogs[$cid][] = "$key=" . json_encode($val);
        } elseif (\is_bool($val)) {
            $this->pushlogs[$cid][] = "$key=" . var_export($val, true);
        } elseif (\is_string($val) || is_numeric($val)) {
            $this->pushlogs[$cid][] = "$key=" . urlencode($val);
        } elseif (null === $val) {
            $this->pushlogs[$cid][] = "$key=";
        }
    }
988760
protected function createHtmlAction($key)
    {
        $html = $this->htmlCodeGenerator->generateHtml($key, 'tt_content');
        $this->saveHtml($key, $html);
        $this->redirect('list');
    }
834312
function set($key,$val) {
		$key=$this->fixheader($key);
		return $this->headers[$key]=$val;
	}