@param array $buttons

@return $this
182547
public function addButtons(array $buttons): self
    {
        foreach ($buttons as $button) {
            if ($button instanceof ElementButton) {
                $this->buttons[] = $button->toArray();
            }
        }

        return $this;
    }
1322303
public function setPages(array $pages)
    {
        $this->pages = array();
        foreach ($pages as $page) {
            $this->addPage($page);
        }
        return $this;
    }
1084139
public function setButton(OneSignalButton $button)
    {
        return $this->setParameter('buttons', array_merge($this->getParameter('buttons', []), [$button->toArray()]));
    }
35982
public function buttons(...$buttons)
    {
        foreach ($buttons as $button) {
            $this->attributes['buttons'][] = $button instanceof Arrayable ? $button->toArray() : $button;
        }

        return $this;
    }
1206853
private function addListeners(array $events)
    {
        foreach ($events as $eventName => $listeners) {
            foreach ($listeners as $listener) {
                if (is_array($listener) && count($listener) === 2 && is_int($listener[1])) {
                    list($listener, $priority) = $listener;
                } else {
                    $priority = 0;
                }
                $this->dispatcher->addListener($eventName, $listener, $priority);
            }
        }

        return $this;
    }
94872
public function setSelectors($selectors)
    {
        $this->selectors = [];
        if (!is_array($selectors)) {
            $selectors = [$selectors];
        }
        foreach ($selectors as $selector) {
            $this->addSelector($selector);
        }

        return $this;
    }
1067860
public function setEventsList(array $events)
    {
        $this->data->events = array_merge($this->data->events, $events);

        return $this;
    }
1039820
public function addButton(Button $button)
    {
        $this->list[] = $button;
        $this->listCount++;
        $this->ulList = false;
        return $this;
    }
362379
protected function cleanup(array $files = array())
    {
        if (empty($files)) {
            return $this;
        }
        foreach ($files as $file) {
            if (!file_exists($file->name)) {
                continue;
            }
            unlink($file->name);
        }
        return $this;
    }
2953
public function buttons($buttons)
    {
        if ($buttons instanceof Closure) {
            $buttons = $buttons($this);
        }

        if (!is_array($buttons)) {
            exit('子菜单必须是数组或者匿名函数返回数组');
        }

        $this->with('sub_button', $buttons);

        return $this;
    }
987738
public function addMethods(array $methods)
    {
        foreach ($methods as $key => $method) {
            $this->addMethod($method, $key);
        }
        return $this;
    }
150371
public function setEventListeners($listeners)
	{
		$this->ensureEventListeners();
		
		foreach ($listeners as $listener) {
			$this->_eventListeners[Ioc::resolveClassName($listener)] = $listener;
		}
		
		return $this;
	}
1000931
public function setActions($actions): Controller
    {
        $this->controllerRoutes = array_merge($this->controllerRoutes, $actions);

        return $this;
    }
211497
protected function setListActions(array $actions)
    {
        $this->parsedListActions = false;

        $this->listActions = $this->mergeActions($this->defaultListActions(), $actions);

        return $this;
    }
348664
public function setElements(array $elements)
    {
        foreach ($elements as $label => $tab) {
            if ($tab instanceof TabInterface) {
                $this->addElement($tab);
            } else {
                $this->appendTab($tab, $label);
            }
        }

        return $this;
    }
871910
public function addButton(AbstractButton $button): self
    {
        $this->isValidButtons([$button], $this->getAllowedButtonsType());

        $this->buttons[] = $button;

        return $this;
    }
184397
public function setOperators(array $operators): self
    {
        foreach ($operators as $operator) {
            $this->validateOperator($operator);
        }
        $this->operators = $operators;

        return $this;
    }