Validates core modules on demand

@throws \LogicException On validation failure
@return void
337084
private function validateCoreModuleNames()
    {
        if (!empty($this->coreModules)) {
            $coreBag = $this->getCoreBag();

            if (!$coreBag->hasAllCoreModules()) {
                throw new LogicException(sprintf(
                    'The framework can not start without defined core modules: %s', implode(', ', $coreBag->getMissingCoreModules())
                ));
            }
        }
    }
965827
protected function initializable()
    {
        if (!$this->getParamAdapter()) {
            throw new Exception\LogicException('Param Adapter is required');
        }

        if (!$this->getSource()) {
            throw new Exception\LogicException('Source data is required');
        }

        $this->init = true;

        if (count($this->headers)) {
            $this->setHeaders($this->headers);
        }

        $this->init();

        $this->initFilters($this->getSource()->getSource());
    }
944558
public function beforeCompile(): void
	{
		$builder = $this->getContainerBuilder();

		if ($builder->getByType(Application::class) === null) {
			throw new LogicException(sprintf('Service of type "%s" is needed. Please register it.', Application::class));
		}

		if ($builder->getByType(EventDispatcherInterface::class) === null) {
			throw new LogicException(sprintf('Service of type "%s" is needed. Please register it.', EventDispatcherInterface::class));
		}

		$dispatcher = $builder->getDefinition($builder->getByType(EventDispatcherInterface::class));

		$application = $builder->getDefinition($builder->getByType(Application::class));

		$application->addSetup('?->onStartup[] = function() {?->dispatch(?, new ?(...func_get_args()));}', [
			'@self',
			$dispatcher,
			ApplicationEvents::ON_STARTUP,
			new PhpLiteral(StartupEvent::class),
		]);

		$application->addSetup('?->onError[] = function() {?->dispatch(?, new ?(...func_get_args()));}', [
			'@self',
			$dispatcher,
			ApplicationEvents::ON_ERROR,
			new PhpLiteral(ErrorEvent::class),
		]);

		$application->addSetup('?->onPresenter[] = function() {?->dispatch(?, new ?(...func_get_args()));}', [
			'@self',
			$dispatcher,
			ApplicationEvents::ON_PRESENTER,
			new PhpLiteral(PresenterEvent::class),
		]);

		$application->addSetup('?->onPresenter[] = function($application, $presenter) {if(!property_exists($presenter, "onStartup")){return;} $presenter->onStartup[] = function() {?->dispatch(?, new ?(...func_get_args()));};}', [
			'@self',
			$dispatcher,
			ApplicationEvents::ON_PRESENTER_STARTUP,
			new PhpLiteral(PresenterStartupEvent::class),
		]);

		$application->addSetup('?->onPresenter[] = function($application, $presenter) {if(!property_exists($presenter, "onShutdown")){return;} $presenter->onShutdown[] = function() {?->dispatch(?, new ?(...func_get_args()));};}', [
			'@self',
			$dispatcher,
			ApplicationEvents::ON_PRESENTER_SHUTDOWN,
			new PhpLiteral(PresenterShutdownEvent::class),
		]);

		$application->addSetup('?->onRequest[] = function() {?->dispatch(?, new ?(...func_get_args()));}', [
			'@self',
			$dispatcher,
			ApplicationEvents::ON_REQUEST,
			new PhpLiteral(RequestEvent::class),
		]);

		$application->addSetup('?->onResponse[] = function() {?->dispatch(?, new ?(...func_get_args()));}', [
			'@self',
			$dispatcher,
			ApplicationEvents::ON_RESPONSE,
			new PhpLiteral(ResponseEvent::class),
		]);

		$application->addSetup('?->onShutdown[] = function() {?->dispatch(?, new ?(...func_get_args()));}', [
			'@self',
			$dispatcher,
			ApplicationEvents::ON_SHUTDOWN,
			new PhpLiteral(ShutdownEvent::class),
		]);
	}
638217
protected function _validate()
	{

		// Check if validation is necessary and parsed
		if (static::$validates === false) return true;
		if (is_null(static::$_validation)) {
			require_once("Validation/Validation.php");
			static::$_validation = Validation\Validation::onModel(get_called_class());
		}

		
		// Go validate!
		$result = static::$_validation->validate($this);

		// Success?
		if ($result->success == false) {

			// Store errors
			$this->_errors = $result->errors;

			return false;
		} else {

			// Clear errors
			$this->_errors = null;

		}

		// True
		return true;

	}
259141
public function validate()
    {
        $this->debug->groupCollapsed(__METHOD__, $this->attribs['name']);
        $this->props['isValid'] = true;
        $this->classRemove($this->props['attribsContainer'], 'has-error');
        $attribs = $this->attribs;
        if (\in_array($attribs['type'], array('checkbox','radio','select'))) {  // these types use the 'options' array
            $this->validateCrs();
        } elseif (\in_array($attribs['type'], array('submit','reset','image'))) {
            $this->debug->log('not checking');
        } elseif (!empty($this->props['newPage'])) {
            $this->debug->log('not checking newPage');
        } elseif (\in_array($attribs['type'], array('file'))) {
            $this->debug->log($attribs['name'].' is a file type');
            if ($this->isRequired() && empty($attribs['disabled']) && empty($attribs['value'])) {
                $this->flag();
            }
        } elseif ($this->isRequired() || $this->props['flagNonReqInvalid']) {
            if (!empty($attribs['placeholder']) && $attribs['value'] === $attribs['placeholder']) {
                $this->debug->log('value == placeholder');
                $attribs['value'] = null;
            }
            $this->validateFromAttributes();
        }
        if ($this->props['isValid']) {
            $isValid = $this->doValidate();
            // validate callback may call flag() directly
            if ($this->props['isValid'] && !$isValid) {
                $this->flag();
            }
        }
        $this->debug->groupEnd();
        return $this->props['isValid'];
    }
740993
protected function validateEditInstall()
    {
        $this->setSubmitted('settings');
        $this->setSubmitted('store.host', $this->server->httpHost());
        $this->setSubmitted('store.language', $this->install_language);
        $this->setSubmitted('store.basepath', trim($this->request->base(true), '/'));

        $this->validateComponent('install');

        return !$this->hasErrors(false);
    }
943881
protected function validateEditor()
    {
        $this->setSubmitted('editor', null, false);

        $this->setSubmitted('user_id', $this->uid);
        $this->setSubmitted('path', $this->data_file);
        $this->setSubmitted('module', $this->data_module);

        $this->validateSyntaxEditor();

        return !$this->hasErrors();
    }
168501
public function boot()
    {
        if ($this->booted) {
            return;
        }

        if (!$this->name) {
            throw new \LogicException('Package: ' . get_class($this) . ' name property should not be empty.');
        }

        $this->getConfig();

        $this->registerProviders($this->getContainer());

        $this->registerListeners($this->getDispatcher());

        $this->registerMiddlewares();

        $this->booted = true;
    }
586823
protected function validate()
    {
        $args = $this->dispatcher->getParam('args');
        if (isset($this->actions[$this->actionName])) {
            $action = $this->actions[$this->actionName];
            $action->validate($args);
        }
    }
813799
protected function performValidation()
    {
        $this->requireProperties(['type']);
        if (isset($this->type)) {
            if (!in_array($this->type, $this->knownTypes)) {
                $this->addError("Unknown Security Scheme type: $this->type");
            } else {
                switch ($this->type) {
                    case "apiKey":
                        $this->requireProperties(['name', 'in']);
                        if (isset($this->in)) {
                            if (!in_array($this->in, ["query", "header", "cookie"])) {
                                $this->addError("Invalid value for Security Scheme property 'in': $this->in");
                            }
                        }
                        break;
                    case "http":
                        $this->requireProperties(['scheme']);
                        break;
                    case "oauth2":
                        $this->requireProperties(['flows']);
                        break;
                    case "openIdConnect":
                        $this->requireProperties(['openIdConnectUrl']);
                        break;
                }
            }
        }
    }
233366
public function validate() {

		if ($this->getConsumedUnits() === null) {
			throw new ValidationException("'consumedUnits' can't be null", 'consumedUnits', $this);
		}
		if ($this->getExternalId() === null) {
			throw new ValidationException("'externalId' can't be null", 'externalId', $this);
		}
		if ($this->getMetric() === null) {
			throw new ValidationException("'metric' can't be null", 'metric', $this);
		}
		if ($this->getSubscription() === null) {
			throw new ValidationException("'subscription' can't be null", 'subscription', $this);
		}
	}
920094
protected function prepareForValidation(): void
    {
        $data = $this->all();

        // Set abilities
        if (! empty($data['abilities'])) {
            if ($this->user($this->route('guard'))->can('grant', \Cortex\Auth\Models\Ability::class)) {
                $abilities = array_map('intval', $this->get('abilities', []));
                $data['abilities'] = $this->user($this->route('guard'))->isA('superadmin') ? $abilities
                    : $this->user($this->route('guard'))->getAbilities()->pluck('id')->intersect($abilities)->toArray();
            } else {
                unset($data['abilities']);
            }
        }

        $this->replace($data);
    }
1185372
protected function prepareForValidation(): void
    {
        $data = $this->all();
        $duration = explode(' - ', $data['duration']);

        $data['starts_at'] = (new Carbon($duration[0]))->toDateTimeString();
        $data['ends_at'] = (new Carbon($duration[1]))->toDateTimeString();

        $this->replace($data);
    }
827703
private function load()
    {
        if ($this->loaded === false) {
            if ($this->autoCreate === true) {
                if (!is_file($this->path)) {
                    $this->touch();
                }
            }

            $array = $this->fileType->fetch($this->path);

            if (is_array($array)) {
                // Keep initial array hash
                $this->hash = $this->serializer->buildHash($array);
                $this->config = $array;
                $this->loaded = true;

                return true;
            } else {
                throw new LogicException(sprintf(
                    'Required file should return an array and only, not "%s"', gettype($array)
                ));
            }
        }

        return true;
    }
1193134
public function validate() : void
    {
        if (null === $this->is_valid) {
            if (null === $this->user_value && null !== $this->default_value) {
                // There is a preset value, and its not being changed
                $this->is_valid = true;
            } elseif (true == $this->user_value || 1 == $this->user_value) {
                $this->user_value = 1;
                $this->is_valid = true;
            } elseif (false == $this->user_value || 0 == $this->user_value || '' == $this->user_value) {
                $this->user_value = 0;
                $this->is_valid = true;
            } elseif (false == $this->validator) {
                // This field does not get validated
                $this->is_valid = true;
            } else {
                $this->is_valid = false;
                $this->error = 'The provided value is not valid. Please enter a valid value.';
            }
        }

        // Check if the input is different from the default value
        if ($this->is_valid && null !== $this->user_value) {
            $this->is_changed = ($this->default_value != $this->user_value);
        }
    }
436606
public function passes()
    {
        if (!($this->validator instanceof \Illuminate\Validation\Validator)) {
            throw new LogicException('No model was set. Nothing to validate.');
        }

        return $this->getValidator()->passes();
    }
85546
public function validate() {
		parent::validate();

		if ($this->getEntity() === null) {
			throw new ValidationException("'entity' can't be null", 'entity', $this);
		}
		if ($this->getEntityStates() === null) {
			throw new ValidationException("'entityStates' can't be null", 'entityStates', $this);
		}
		if ($this->getUrl() === null) {
			throw new ValidationException("'url' can't be null", 'url', $this);
		}
	}