True if a new container can be created
@return bool
344564
protected function CanCreate()
    {
        return self::Guard()->Allow(BackendAction::Create(), new Container())
            && self::Guard()->Allow(BackendAction::UseIt(), new ContainerForm());
    }
473773
public function canApply()
    {
        $parent = $this->getSubject()->getParent();
        $nodeType = $this->getNodeType();

        return $parent->isNodeTypeAllowedAsChildNode($nodeType);
    }
721938
public function has($name)
    {
        $tid = $this->getTid($name);
        if (!isset($this->_containers[$tid])) {
            return false;
        }
        return $this->_containers[$tid]->has($name);
    }
43207
public function instance_can_be_docked() {
        return parent::instance_can_be_docked() && isset($this->config->title) && !empty($this->config->title);
    }
27269
public static function buildContainer(): Container
    {
        if (self::$container !== null) {
            return self::$container;
        }

        $factory = new ContainerBuilder();
        $factory->useAnnotations(true);

        if ((new ContextHelper())->isProduction()) {
            $factory->enableDefinitionCache();

            if (!is_dir(MELIOR_BASE.'/Data/Persistent/Container/Proxies')) {
                mkdir(MELIOR_BASE.'/Data/Persistent/Container/Proxies', 0755, true);
            }

            $factory->enableCompilation(MELIOR_BASE.'/Data/Persistent/Container');
            $factory->writeProxiesToFile(true, MELIOR_BASE.'/Data/Persistent/Container/Proxies');
        }

        $packages = (new PackageService(new PathHelper(), new ComposerParser()))->getApplicationPackages();

        foreach ($packages as $name => $data) {
            $extra = $data->getExtra();

            if (!array_key_exists('melior', $extra)) {
                continue;
            }

            $meliorData = $extra['melior'];

            if (!array_key_exists('containerDefinitions', $meliorData)) {
                continue;
            }

            $definitions = $meliorData['containerDefinitions'];

            if (is_string($definitions)) {
                $definitions = [$definitions];
            } elseif (!is_array($definitions)) {
                continue;
            }

            foreach ($definitions as $definitionFile) {
                $filepath = realpath("$name/$definitionFile");

                if (!is_file($filepath) || !\is_readable($filepath)) {
                    continue;
                }

                $factory->addDefinitions($filepath);
            }
        }

        $container = $factory->build();

        self::$container = $container;

        return $container;
    }
548157
public function canCreate($member) {
        if (!$this->owner->isCreatable()) {
            return false;
        }

        if (!$member) {
            $member = Member::currentUserID();
        }

        if ($member && is_numeric($member)) {
            $member = DataObject::get_by_id('Member', $member);
        }

        $cachedPermission = self::cache_permission_check('create', $member, $this->owner->ID);
        if (isset($cachedPermission)) {
            return $cachedPermission;
        }

        if ($member && Permission::checkMember($member, "ADMIN")) {
            return true;
        }

        $extended = $this->owner->extendedCan('canCreateLocations', $member);
        if ($extended !== null) {
            return $extended;
        }

        return false;
    }
39371
public function canCreate($member = null, $context = [])
    {
        // Allow Only Root Level:
        
        if (isset($context['Parent'])) {
            return false;
        }
        
        // Answer Permission Check:
        
        return Permission::checkMember($member, ['ADMIN', 'SILVERWARE_FOLDER_CREATE']);
    }
1259208
public function valid()
    {

        if ($this->container['date'] === null) {
            return false;
        }
        if ($this->container['refId'] === null) {
            return false;
        }
        if ($this->container['refType'] === null) {
            return false;
        }
        $allowedValues = $this->getRefTypeAllowableValues();
        if (!in_array($this->container['refType'], $allowedValues)) {
            return false;
        }
        $allowedValues = $this->getFirstPartyTypeAllowableValues();
        if (!in_array($this->container['firstPartyType'], $allowedValues)) {
            return false;
        }
        $allowedValues = $this->getSecondPartyTypeAllowableValues();
        if (!in_array($this->container['secondPartyType'], $allowedValues)) {
            return false;
        }
        return true;
    }
1346268
public function valid()
    {
        if ($this->container['maxDockableShipVolume'] === null) {
            return false;
        }
        if ($this->container['name'] === null) {
            return false;
        }
        if ($this->container['officeRentalCost'] === null) {
            return false;
        }
        if ($this->container['reprocessingEfficiency'] === null) {
            return false;
        }
        if ($this->container['reprocessingStationsTake'] === null) {
            return false;
        }
        if ($this->container['services'] === null) {
            return false;
        }
        if ($this->container['stationId'] === null) {
            return false;
        }
        if ($this->container['systemId'] === null) {
            return false;
        }
        if ($this->container['typeId'] === null) {
            return false;
        }
        return true;
    }
1365853
public function create()
    {
        if ($this->scenario != self::SCENARIO_CREATE) {
            return false;
        }

        if (!$this->validate()) {
            return false;
        }

        $rule = \Yii::createObject([
            'class' => $this->class,
            'name'  => $this->name,
        ]);
        
        $this->authManager->add($rule);
        $this->authManager->invalidateCache();
        
        return true;
    }
982336
protected function buildContainer()
    {
        $container = new ContainerBuilder($this->parameters);
        $container->addCompilerPass(new ConfigurationServiceRegistrationCompilerPass());
        $container->addCompilerPass(new AwarenessCompilerPass());

        $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/Resources'));
        $loader->load('services.yml');

        return $container;
    }
1179733
public function can_export_configuration() : bool {

        if (empty($this->model->timesplitting)) {
            return false;
        }
        if (!$this->get_indicators()) {
            return false;
        }

        if ($this->is_static()) {
            return false;
        }

        return true;
    }
883362
protected function Container()
    {
        if (!$this->container) {
            $this->container = new Container(Request::GetData('container'));
        }
        return $this->container;
    }
98111
public function canCreate(ContainerInterface $container, $requestedName)
    {
        /** @var BlockPluginManager $blockPluginManager */
        $blockPluginManager = $container->get(BlockPluginManager::class);
        $blocks = $blockPluginManager->getAvailableBlocks();

        return in_array($requestedName, $blocks);
    }
565339
protected function buildContainer() {
		$cache = $this->getCache();
		if($cache) {
			if(($container = $cache->fetch('asgard.container')) instanceof \Asgard\Container\Container) {
				$container['kernel'] = $this;
				$container['errorHandler'] = $this->errorHandler;

				$this->container = $container;
				#make $this->container the default instance of Container, in case someones uses it
				\Asgard\Container\Container::setInstance($this->container);
				return $this->container;
			}
		}

		$bundles = $this->getAllBundles();
		#use the Container default instance, in case someones uses it
		$container = $this->container = \Asgard\Container\Container::singleton();
		$container['errorHandler'] = $this->errorHandler;
		$container['kernel'] = $this;
		$container['config'] = $this->getConfig();

		foreach($bundles as $bundle)
			$bundle->buildContainer($container);

		if($cache)
			$cache->save('asgard.container', $container);

		return $container;
	}
244874
public function create()
    {
        $return = false;
        if (!$this->isExists()) {
            if (mkdir($this->getPathname(), 0777, true)) {
                $return = true;
            } else {
                throw new RuntimeException("Can't create " . $this->getPathname() . ' folder');
            }
        }

        return $return;
    }
628265
protected function canBuild()
    {
        if (!empty($this->requiredParams)) {
            $this->builder->build($this->requiredParams, $this->params);

            if ($this->builder->getErrors()) {
                return false;
            }
            return $this->builder->getParams();
        }
        return true;
    }