@param string $name
@param array $options

@return QueueBuilder
503291
public function queue($name, array $options = [])
    {
        return $this->queues[$name] = (new QueueBuilder($this, $name))->options($options);
    }
672534
public function pathBuilder($name = null, array $options = []) {
		if ($name instanceof PathBuilderInterface) {
			$this->_pathBuilder = $name;

			return $this->_pathBuilder;
		}

		if ($name !== null) {
			$this->_pathBuilder = $this->createPathBuilder($name, $options);
		}

		return $this->_pathBuilder;
	}
1125192
protected function createResourceClient(string $name, array $options = []): ResourceInterface
    {
        $entry = $this->manifest->getResource($name);
        # we check for the manifest entry
        
        if (empty($entry)) {
            throw new ResourceNotFoundException('Could not find the client for the requested resource '.$name);
        }
        $resource = $entry['namespace'] . '\\' . $entry['client'];
        return new $resource($this, ...$options);
    }
928935
public function createCollection($name, array $options = [])
    {
        if (isset($this->collections[$name])) {
            throw new RuntimeException('collection already exists');
        }

        $this->collections[$name] = [
            'collection' => new MockCollection($name, $this),
            'options' => $options
        ];

        return [
            'ok' => 1.0
        ];
    }
1216765
public function addHeader($name, $options)
    {
        $header = new Header($name, $options);
        $header->setTable($this);
        $this->headersObjects[$name] = $header;
    }
816906
public function menu($name)
    {
        if (array_key_exists($name, $this->menus)) {
            return $this->menus[$name];
        }

        return $this->menus[$name] = new MenuBuilder($name, $this->config);
    }
1272102
public function checkbox(string $name, array $options = []): FieldTypeInterface
    {
        return (new CheckboxType($name))
            ->setLocale($this->app->getLocale())
            ->setViewFactory($this->viewFactory)
            ->setOptions($options);
    }
617276
public function with($name, array $options = [])
    {
        /*
         * The current implementation should work with the following workflow:
         *
         *     $formMapper
         *        ->with('group1')
         *            ->add('username')
         *            ->add('password')
         *        ->end()
         *        ->with('tab1', ['tab' => true])
         *            ->with('group1')
         *                ->add('username')
         *                ->add('password')
         *            ->end()
         *            ->with('group2', ['collapsed' => true])
         *                ->add('enabled')
         *                ->add('createdAt')
         *            ->end()
         *        ->end();
         *
         */
        $defaultOptions = [
            'collapsed' => false,
            'class' => false,
            'description' => false,
            'label' => $name, // NEXT_MAJOR: Remove this line and uncomment the next one
//            'label' => $this->admin->getLabelTranslatorStrategy()->getLabel($name, $this->getName(), 'group'),
            'translation_domain' => null,
            'name' => $name,
            'box_class' => 'box box-primary',
        ];

        // NEXT_MAJOR: remove this code
        if ($this->admin instanceof AbstractAdmin && $pool = $this->admin->getConfigurationPool()) {
            if ($pool->getContainer()->getParameter('sonata.admin.configuration.translate_group_label')) {
                $defaultOptions['label'] = $this->admin->getLabelTranslatorStrategy()->getLabel($name, $this->getName(), 'group');
            }
        }

        $code = $name;

        // Open
        if (\array_key_exists('tab', $options) && $options['tab']) {
            $tabs = $this->getTabs();

            if ($this->currentTab) {
                if (isset($tabs[$this->currentTab]['auto_created']) && true === $tabs[$this->currentTab]['auto_created']) {
                    throw new \RuntimeException('New tab was added automatically when you have added field or group. You should close current tab before adding new one OR add tabs before adding groups and fields.');
                }

                throw new \RuntimeException(sprintf('You should close previous tab "%s" with end() before adding new tab "%s".', $this->currentTab, $name));
            } elseif ($this->currentGroup) {
                throw new \RuntimeException(sprintf('You should open tab before adding new group "%s".', $name));
            }

            if (!isset($tabs[$name])) {
                $tabs[$name] = [];
            }

            $tabs[$code] = array_merge($defaultOptions, [
                'auto_created' => false,
                'groups' => [],
            ], $tabs[$code], $options);

            $this->currentTab = $code;
        } else {
            if ($this->currentGroup) {
                throw new \RuntimeException(sprintf('You should close previous group "%s" with end() before adding new tab "%s".', $this->currentGroup, $name));
            }

            if (!$this->currentTab) {
                // no tab define
                $this->with('default', [
                    'tab' => true,
                    'auto_created' => true,
                    'translation_domain' => $options['translation_domain'] ?? null,
                ]); // add new tab automatically
            }

            // if no tab is selected, we go the the main one named '_' ..
            if ('default' !== $this->currentTab) {
                $code = $this->currentTab.'.'.$name; // groups with the same name can be on different tabs, so we prefix them in order to make unique group name
            }

            $groups = $this->getGroups();
            if (!isset($groups[$code])) {
                $groups[$code] = [];
            }

            $groups[$code] = array_merge($defaultOptions, [
                'fields' => [],
            ], $groups[$code], $options);

            $this->currentGroup = $code;
            $this->setGroups($groups);
            $tabs = $this->getTabs();
        }

        if ($this->currentGroup && isset($tabs[$this->currentTab]) && !\in_array($this->currentGroup, $tabs[$this->currentTab]['groups'], true)) {
            $tabs[$this->currentTab]['groups'][] = $this->currentGroup;
        }

        $this->setTabs($tabs);

        return $this;
    }
1315492
public function create($name, $options = [])
    {
        if ($this->menus->has($name)) {
            throw new MenuAlreadyExistsException("Can not create menu named `$name` because it already exists");
        }

        $this->menus->put($name, $instance = MenuFactory::create($name, $options));

        return $instance;
    }
30007
public function create($name, $type = null, array $options = [])
    {
        return $this->formBuilder->create($name, $type, $options);
    }
315092
private static function queue(string $name = null) : Queue
    {
        list($container, $config, $return) = DI::detect(__METHOD__, 'queue', $name);

        if ($return) {
            return $return;
        }

        $db = new Queue($config);

        return DI::set(__METHOD__, $container, $db);
    }
1194057
public static function getAgent($name, array $options = [])
    {
        if (!self::hasAgent($name)) {
            $scheme = self::scheme($name);
            $config = self::config($name);
            if (is_array($scheme) && empty($options)) {
                $options = self::parseScheme($scheme);
            }
            if (isset($options['scheme'])) {
                unset($options['scheme']);
            }
            $className = "Toplan\\PhpSms\\{$name}Agent";
            if (isset($options['agentClass'])) {
                $className = $options['agentClass'];
                unset($options['agentClass']);
            }
            if (!empty($options)) {
                self::$agents[$name] = new ParasiticAgent($config, $options);
            } elseif (class_exists($className)) {
                self::$agents[$name] = new $className($config);
            } else {
                throw new PhpSmsException("Not support agent `$name`.");
            }
        }

        return self::$agents[$name];
    }
1267070
protected function getOptionsList($name, $options)
    {
        if (empty($options)) {
            $options = $this->getOptionsFromModel($name);
        }

        return $options;
    }
1219716
public function compose($name = null, $options = array())
    {
        if (!self::$menuInstance) {

            $id       = from_route('customfields');
            $category = from_route('category');
            $fields   = FieldView::query()->get(['id', 'category_name'])->groupBy('category_name');
            $menu     = app('antares.widget')->make('menu.customfields.pane');
            foreach ($fields as $name => $items) {
                $active = false;
                if (!is_null($id)) {
                    foreach ($items as $item) {
                        if ($item->id != $id) {
                            continue;
                        }
                        $active = true;
                        break;
                    }
                } else {
                    $active = $category == $name;
                }

                $menu->add($name)
                        ->link(handles('antares::customfields/' . $name . '/index'))
                        ->title(ucfirst($name) . ' (' . $items->count() . ')')
                        ->active($active);
            }
            self::$menuInstance = $menu;
            $app                = Container::getInstance();
            $pane               = $app->make('antares.widget')->make('pane.left');
            $pane->add('logger')->content(view('antares/customfields::admin.partials._left_pane'));
        }
    }
945638
public static function buildKeyValidation(array $options, $name)
    {
        if (!key_exists(Properties::TYPE, $options)) {
            trigger_error($name . ' must have a type');
        }

        switch ($options[Properties::TYPE]) {
            case Types::STR:
            case Types::STRING:
                return new StringValidation($name, $options);
            case Types::INT:
            case Types::INTEGER:
                return new IntegerValidation($name, $options);
            case Types::FLOAT:
                return new FloatValidation($name, $options);
            case Types::BOOLEAN:
                return new BooleanValidation($name, $options);
            case Types::ARRY:
                return new ArrayValidation($name, $options);
            default:
                trigger_error(sprintf('%s is unknown', $options[Properties::TYPE]), E_USER_ERROR);
        }
    }
1213714
public static function setOptions(string $name, array $options)
    {
        if (isset(self::$options[$name]))
        {
            foreach(self::$options[$name] as $item)
                if ($item === $options)
                    return ;
        }
        self::$options[$name][] = $options;
    }
481160
protected function createBaseBuilder(array $options = [])
    {
        $query = $this->createQueryBuilder();

        $this->applyResourceOptions($query, $options);

        if (empty($options['sort'])) {
            $this->defaultSort($query, $options);
        }

        return $query;
    }