@param $domainId
@param $definition

@throws \yii\base\InvalidConfigException
328667
private static function define($domainId, $definition) {
		$definition = ConfigHelper::normalizeItemConfig($domainId, $definition);
		if(!\App::$domain->has($domainId)) {
			\App::$domain->set($domainId, $definition);
		}
	}
1013312
public function supports(IDefinition $definition) {
        $handler = $definition->getHandler();

        if ($this->isValidHandler($handler)) {
            return true;
        }

        if ($this->isValidHandlerClass($handler)) {
            return true;
        }

        return false;
    }
398104
public function init()
    {
        if ($this->dataProvider === null) {
            throw new InvalidConfigException('The "dataProvider" property must be set.');
        }
        if ($this->emptyText === null) {
            $this->emptyText = Yii::t('yii', 'No results found.');
        }
        if (!isset($this->options['id'])) {
            $this->options['id'] = $this->getId();
        }
    }
278823
protected function setDefinition($id, $definition, $shared = false)
    {
        $this->definitions[$id] = $definition;
        if (true === $shared) {
            $this->shared[$id] = $id;
        }
    }
1272191
public function init()
    {
        if ($this->attribute === null) {
            throw new InvalidConfigException('Please specify the "attribute" property.');
        }

        if (!isset($this->options['id'])) {
            $this->options['id'] = $this->getMdeditorId();
        }
    }
630516
private function setDomainId(DomainId $domainId)
    {
        if ($this->domainId !== null) {
            throw new ImmutableProperty('Domain ID cannot be changed.');
        }

        $this->domainId = $domainId;
    }
206623
public function setParameter($key, $value, $domain = null)
    {
        if (is_null($domain)) {
            $this->config[$key] = $value;

            return $this;
        }
        if (!isset($this->config[$domain])) {
            $this->config[$domain] = array();
        }
        $this->config[$domain][$key] = $value;

        return $this;
    }
222799
public function useSerialization(SerializationDefinition $definition)
    {
        $this->settings->set(SerializationDefinition::class, $definition);

        return $definition->createConfigurator($this->settings);
    }
70816
public function init()
    {
        if ($this->pagination === null) {
            throw new InvalidConfigException('The "pagination" property must be set.');
        }

        if ($this->widgetId === null) {
            throw new InvalidConfigException('The "widgetId" property must be set.');
        }

        // Publish assets and register main plugin code
        InfiniteScrollAsset::register($this->view);

        // Register configured behavior, if any
        $behavior = ArrayHelper::getValue($this->pluginOptions, 'behavior', null);
        if (!is_null($behavior)) {
            switch ($behavior) {
                case self::BEHAVIOR_TWITTER:
                    $behaviorAsset = 'manual-trigger.js';
                    break;
                case self::BEHAVIOR_LOCAL:
                    $behaviorAsset = 'local.js';
                    break;
                case self::BEHAVIOR_MASONRY:
                    $behaviorAsset = 'masonry-isotope.js';
                    break;
                case self::BEHAVIOR_CUFON:
                    $behaviorAsset = 'cufon.js';
                    break;
                default:
                    $behaviorAsset = false;
            }
            if ($behaviorAsset) {
                $assetManager = $this->view->getAssetManager();
                $assetBundle = $assetManager->getBundle(InfiniteScrollAsset::className());
                $behaviorUrl = $assetManager->getAssetUrl($assetBundle, 'behaviors/' . $behaviorAsset);
                $this->view->registerJsFile($behaviorUrl, [
                    'depends' => [InfiniteScrollAsset::className()]
                ]);
            }
        }

        $widgetSelector = '#' . $this->widgetId;

        // Set default plugin selectors / options if not configured
        if (is_null(ArrayHelper::getValue($this->pluginOptions, 'maxPage', null)))
            $this->pluginOptions['maxPage'] = $this->pagination->getPageCount();

        if (is_null(ArrayHelper::getValue($this->pluginOptions, 'contentSelector', null)))
            $this->pluginOptions['contentSelector'] = $widgetSelector . ' .' . $this->itemsCssClass;

        if (is_null(ArrayHelper::getValue($this->pluginOptions, 'itemSelector', null)))
            $this->pluginOptions['itemSelector'] = $this->pluginOptions['contentSelector'] . ' >';

        if (is_null(ArrayHelper::getValue($this->pluginOptions, 'navSelector', null)))
            $this->pluginOptions['navSelector'] = $widgetSelector . " ul." . $this->options['class'];

        if (is_null(ArrayHelper::getValue($this->pluginOptions, 'nextSelector', null)))
            $this->pluginOptions['nextSelector'] = $this->pluginOptions['navSelector'] . ' li.' . $this->nextPageCssClass . " a:first";

        if (is_null(ArrayHelper::getValue($this->pluginOptions, 'loading', null)))
            $this->pluginOptions['loading'] = [];
        if (is_null(ArrayHelper::getValue($this->pluginOptions['loading'], 'img', null))) {
            $assetManager = $this->view->getAssetManager();     // Publish loader img
            list ($imgPath, $imgUrl) = $assetManager->publish('@vendor/nirvana-msu/yii2-infinite-scroll/assets/images/ajax-loader.gif');
            $this->pluginOptions['loading']['img'] = $imgUrl;
        }
    }
257382
private function _initType($definition)
    {
        if (isset(self::$typeAliases[$definition])) {
            $definition = self::$typeAliases[$definition];
        }

        if (self::isScalarType($definition)
            || in_array(
                $definition,
                [self::TYPE_ARRAY, self::TYPE_DATE, self::TYPE_DATETIME],
                true
            )
        ) {
            // Scalar, array, date, datetime

            $this->type = $definition;
        } elseif (class_exists(Convention::nameToClass($definition, Convention::ENTITY_MASK))) {
            // Entity

            $this->type = self::TYPE_ENTITY;
            $this->typeOption = $definition;
        } elseif (substr($definition, -2) === "[]") {
            // Collection

            $this->type = self::TYPE_COLLECTION;
            $this->typeOption = rtrim($definition, "[]");
        } else {
            throw new Exception\PropertyException(
                "Unsupported type '" . $definition . "'!"
            );
        }
    }
694861
public function addRouteDefinition(RouteDefinition $definition): void
    {
        $name = $definition->getName();

        if (isset($this->routesByName[$name])) {
            throw new \InvalidArgumentException("Route with name '$name' already exists");
        }

        $routeId = \count($this->routeDefinitions);
        $segments = $definition->getSegments();

        $this->routeDefinitions[$routeId] = $definition->getDefinitionCache();
        $this->routesByName[$name] = $routeId;

        if ($definition->isStatic()) {
            $this->staticRoutes[implode('/', $segments)][] = $routeId;
            return;
        }

        foreach ($segments as $i => $segment) {
            $this->segmentValues[$i][$segment][$routeId] = $routeId;

            if (!isset($this->segmentCounts[$i])) {
                $this->segmentCounts[$i] = [];
            }
        }

        $this->segmentCounts[\count($segments)][$routeId] = $routeId;
    }
854210
public function setDomain(Domain $domain)
    {
        $this->domain = $domain;
        $this->domainId = $domain->getDomainId();
    }
80425
public function init()
	{
		if (!in_array($this->extension, static::$ALLOWED_EXTENSIONS)) {
			$msg = Yii::t('app', 'Illegal extension {ext}, only these are allowed: {allowed}', [
				'ext'=>$this->extension,
				'allowed'=>implode(', ', static::$ALLOWED_EXTENSIONS),
			]);
			throw new InvalidConfigException($msg);
		}
	}
844477
public static function getClassConfig(string $domainId, $className, array $classDefinition = null) {
		$definition = self::getConfigFromDomainClass($className);
		$definition = ConfigHelper::normalizeItemConfig($domainId, $definition);
		if(!empty($classDefinition)) {
			$classDefinition =  ConfigHelper::normalizeItemConfig($domainId, $classDefinition);
			$definition = ArrayHelper::merge($definition, $classDefinition);
		}
		$definition['class'] = $className;
		return $definition;
	}
1208564
private void removeDomain(Long domainId, boolean reverse) throws GloboDnsException {
		if (domainId == null) {
			throw new GloboDnsException("Domain id cannot be null");
		}
		
		GloboDnsRoot<Domain> globoDnsRoot = this.delete("/domains/" + domainId + ".json" + (reverse ? "?reverse=true" : ""), false);
		if (globoDnsRoot == null) {
			throw new GloboDnsException("Invalid response");
		}
		return;
	}
567994
public function initialise(cache_definition $definition) {
        if ($this->is_initialised()) {
            throw new coding_exception('This mongodb instance has already been initialised.');
        }
        $this->database = $this->connection->selectDatabase($this->databasename);
        $this->definitionhash = 'm'.$definition->generate_definition_hash();
        $this->collection = $this->database->selectCollection($this->definitionhash);

        $options = array('name' => 'idx_key');

        $w = $this->usesafe ? 1 : 0;
        $wc = new MongoDB\Driver\WriteConcern($w);

        $options['writeConcern'] = $wc;

        $this->collection->createIndex(array('key' => 1), $options);
    }
1033833
public function attach($returnType, $definition = null)
    {
        if (!$returnType instanceof TypeInterface) {
            $wrong = \is_object($returnType) ? 'instance of '.\get_class($returnType) : \gettype($returnType);

            throw new InvalidArgumentException(
                sprintf('Expecting an instance of %s, got %s', TypeInterface::class, $wrong)
            );
        }

        parent::attach($returnType, $definition);

        return $this;
    }