Create new row and add in collection

@param string $pattern
@param string|\Closure $action
@param string|null $name
773714
public function trace($pattern, $action, $name =  null)
    {
        return $this->addRoute(['TRACE'], $pattern, $action, $name);
    }
590609
protected function addRoute($method, $pattern, $callback, array $middleware = null, $name = null)
    {
        $concatenatedPattern = (!is_null($this->prefix) ? '/' . $this->prefix : '') .
            $pattern;

        $this->collector->addRoute(strtoupper($method), $concatenatedPattern, new Route($callback, $middleware));

        if ($name !== null) {
            $this->namedRoutes[$name] = $concatenatedPattern;
        }
    }
951947
public function add(PatternInterface $pattern)
    {
        $this->collection[$this->length] = $pattern;
        $this->length++;

        return $this;
    }
913746
public function addPattern($pattern)
    {
        $this->doAddPattern($this->convertPattern($pattern));
        $this->hasPattern = true;
    }
1346050
public function addSlot($name, Closure $closure, array $arguments)
    {
        $this->closures[$name] = $closure;
        $this->arguments[$name] = $arguments;
    }
555794
public function ajax($patternUri, $action, $name)
    {
        $route = new Route("ajax", $patternUri, $action, $name);
        $this->container->addRoute($route);
        return $route;
    }
829351
public function addAction($name, ActionInterface $action, $priority = Priority::DEFAULT_PRIORITY)
    {
        $this->actions[] = array(
            'name' => $name,
            'action' => $action,
            'priority' => $priority,
        );
    }
750923
public function addRoute($name, $pattern = null, $variables = [], $method = [], $options = [])
    {
        if ($name instanceof Route) {
            $route = $name;
        } else {
            if (!is_string($pattern)) {
                throw new \InvalidArgumentException('Route pattern should be string');
            }

            $route = new Route($name, $pattern, $variables, $method, $options);
        }

        // Group
        if ($this->group) {
            $pattern = $route->getPattern();
            $pattern = rtrim($this->group, '/') . '/' . ltrim($pattern, '/');
            $route->setPattern($pattern);
        }

        // Add route
        if ($name = $route->getName()) {
            $this->routes[$name] = $route;
        } elseif (!$name || is_numeric($name)) {
            $this->routes[] = $route;
        }

        return $route;
    }
852574
public function findFieldsetOrCreateNew($name, Closure $callback = null)
    {
        foreach ($this->fieldsets as $fieldset) {
            if ($fieldset->getName() === $name) {
                $fieldset->update($callback);

                return $this->fieldsets;
            }
        }

        return $this->fieldset($name, $callback);
    }
966655
public function addMatcher($name, MatcherInterface $rule)
    {
        if ($rule->hasValue()) {
            $this->rules[$name][] = $rule;
        }
    }
64356
public function item($name, $value, $action = 'add')
    {
        $method_name = $action.'ItemAttribute';
        $this->$method_name($name, $value);

        return $this;
    }
199521
public function getNewActionEvent(string $name = null, $target = null, $params = null): ActionEvent
    {
        if ($name === null) {
            $name = 'action_event';
        }

        return new DefaultActionEvent($name, $target, $params);
    }
213519
public function beginForm(string $name, string $action): void
    {
        $this->formOptions = $this->getFormOptions($name);

        $form = "<form id=\"{$name}\" action=\"{$action}\" method=\"post\"";

        $usePjax = (isset($this->formOptions['use_pjax'])) ?
            filter_var($this->formOptions['use_pjax'], FILTER_VALIDATE_BOOLEAN)
            : true;

        $pjaxAttr = ($usePjax) ? 'data-pjax' : '';

        foreach ($this->formOptions as $attr => $value) {
            if (in_array($attr, ['use_pjax', 'use_csrf', 'fields'])) {
                continue;
            }

            $form .= " {$attr}=\"{$value}\"";
        }

        echo "$form $pjaxAttr>";
    }
1265623
public static function create(string $action = null, $gadgetIds = null, $colors = null, $repeat = null): self
    {
        $pattern = new self();

        $pattern->action    = $action;
        $pattern->gadgetIds = $gadgetIds;
        $pattern->colors    = $colors;
        $pattern->repeat    = $repeat;

        return $pattern;
    }
1336520
public function addListAction($name, array $action)
    {
        foreach ([
            'label' => $name,
            'params' => [],
            'translation_domain' => '',
            'action' => '',
            'route' => '',
        ] as $field => $value) {
            if (empty($action[$field])) {
                $action[$field] = $value;
            }
        }

        if (!$action['action'] && !$action['route']) {
            return $this;
        }

        $this->listActions[$name ? $name : $action['label']] = $action;

        return $this;
    }
1369816
public function delete($pattern, $action, $name = null)
	{
		return $this->addRoute(['DELETE'], $pattern, $action, $name);
	}
722884
private function IsValidFormat($Name, $Pattern, $Value)
        {
            if (! empty($Value)) {
                if (! preg_match($Pattern, $Value)) {
                    throw new Exception('Invalid '.$Name.'.');
                }
            }
        }