Validate the process can be run.

@throws LogicException
7329
protected final function validate()
    {
        if (isset($this->pid) && !isset($this->resource)) {
            throw new LogicException('Process already closed.', static::ERR_COMPLETED);
        } elseif ($this->running) {
            throw new LogicException('Process already running.', static::ERR_RUNNING);
        }

        $this->command->validate();
    }
132394
public function validate() {

		if ($this->getLabel() === null) {
			throw new ValidationException("'label' can't be null", 'label', $this);
		}
		if ($this->getValue() === null) {
			throw new ValidationException("'value' can't be null", 'value', $this);
		}
	}
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),
		]);
	}
321673
public function validate() {

		if ($this->getCurrency() === null) {
			throw new ValidationException("'currency' can't be null", 'currency', $this);
		}
		if ($this->getProduct() === null) {
			throw new ValidationException("'product' can't be null", 'product', $this);
		}
		if ($this->getSubscription() === null) {
			throw new ValidationException("'subscription' can't be null", 'subscription', $this);
		}
	}
85314
public function validate($value)
    {
        // if value required, then only valueTrue is allowed
        if ($this->required && $value !== $this->valueTrue) {
            throw new ValidationException([$this->name => 'Must be selected']);
        }
    }
743743
protected function validateFileContents() {
		if (!$this->fileName) {
			throw new \LogicException("Missing file's path. Looks like severe internal error.");
		}
		$this->validateFilePath($this->fileName);
		if (!$this->sha1hash) {
			throw new \LogicException("Missing file's SHA1 hash. Looks like severe internal error.");
		}
		if ($this->sha1hash !== sha1_file($this->fileName)) {
			throw new IOException("The file on disk has changed and this " . get_class($this) . " class instance is no longer valid for use. Please create fresh instance.");
		}
		return true;
	}
904272
public function validate(): void
    {
        $paths = $this->getConfigPaths();

        foreach ($paths as $path) {
            WP_CLI::line(
                WP_CLI::colorize("%B====> Validating $path%n")
            );

            try {
                Toml::parseFile($path);
                WP_CLI::success("File '$path' is valid.");
            } catch (ParseException $parseException) {
                WP_CLI::error_multi_line([
                    $parseException->getMessage(),
                ]);

                WP_CLI::warning("File '$path' will be ignored.");
            }

            // Print a empty line for better UX.
            WP_CLI::line('');
        }
    }
900582
public function validate()
    {
        if ($this->isWorkflowDispatch() && null === $this->getWorkflowRunType()) {
            $errMsg = 'workflowRunType not specified';
            throw new Exception\InvalidMetadataException($errMsg);
        }

        if ($this->isFlagRunPrepareData()) {
            if (null === $this->getPrepareDataMethod()) {
                $errMsg = 'prepareDataMethod not specified';
                throw new Exception\InvalidMetadataException($errMsg);
            }
            if (null === $this->getPrepareDataMethod()) {
                $errMsg = 'prepareDataMethod not specified';
                throw new Exception\InvalidMetadataException($errMsg);
            }
        }

        if ($this->getFlagHasConditions()) {
            if (0 === count($this->getConditions())) {
                $errMsg = 'empty conditions';
                throw new Exception\InvalidMetadataException($errMsg);
            }

            foreach ($this->getConditions() as $condition) {
                $condition->validate();
            }
        }
    }
1248515
public function validate() {

		if ($this->getAmountIncludingTax() === null) {
			throw new ValidationException("'amountIncludingTax' can't be null", 'amountIncludingTax', $this);
		}
		if ($this->getName() === null) {
			throw new ValidationException("'name' can't be null", 'name', $this);
		}
		if ($this->getQuantity() === null) {
			throw new ValidationException("'quantity' can't be null", 'quantity', $this);
		}
		if ($this->getType() === null) {
			throw new ValidationException("'type' can't be null", 'type', $this);
		}
		if ($this->getUniqueId() === null) {
			throw new ValidationException("'uniqueId' can't be null", 'uniqueId', $this);
		}
	}
1193650
public function check() : void {
        $processesInfo = $this->getProcessesInfo();

        foreach($this->processes as $process) {
            foreach($processesInfo as $processInfo) {
                if( Str::startsWith($processInfo->getCommand(), $process->getCommand()) ) {
                    $process->setInfo($processInfo);
                    break 2;
                }
            }
        }

        $this->checked = true;
    }
480603
public function validate()
    {
        if (!$this->translations) {
            throw new MappingException(sprintf('No translations specified for %s', $this->name));
        }

        if (!$this->targetEntity) {
            throw new MappingException(sprintf('No translations targetEntity specified for %s', $this->name));
        }
    }
388104
public function validate() {

		if ($this->getRate() === null) {
			throw new ValidationException("'rate' can't be null", 'rate', $this);
		}
		if ($this->getTitle() === null) {
			throw new ValidationException("'title' can't be null", 'title', $this);
		}
	}
1369860
public function getProcess()
    {
        if (0 === count($this->prefix) && 0 === count($this->arguments)) {
            throw new LogicException('You must add() command arguments before calling getProcess().');
        }

        $options = $this->options;

        $arguments = array_merge($this->prefix, $this->arguments);
        $script = implode(' ', array_map(array(__NAMESPACE__.'\\ProcessUtils', 'escapeArgument'), $arguments));

        if ($this->inheritEnv) {
            $env = array_replace($_ENV, $_SERVER, $this->env);
        } else {
            $env = $this->env;
        }

        $process = new Process($script, $this->cwd, $env, $this->input, $this->timeout, $options);

        if ($this->outputDisabled) {
            $process->disableOutput();
        }

        return $process;
    }
987378
public function validate()
    {
        if ($this->binary === false) {
            throw new CommandException("Command not found.");
        }

        if (!is_executable($this->binary)) {
            throw new CommandException("$this not executable.");
        }

        $nargs = false;
        foreach ($this->options as $option => $value) {
            if (is_array($value)) {
                if ($nargs) {
                    throw new CommandException("Multiple nargs detected.");
                }

                $nargs = true;
            }
        }
    }
1009756
public function send($input)
    {
        if (!$this->isAlive()) {
            throw new LogicException('Process is not alive.');
        } elseif (!$this->interactive) {
            throw new LogicException("Process [{$this->pid}] not running interactively.");
        }

        $bytes = fwrite($this->pipes[static::STDIN], $input, strlen($input));
        if ($bytes === false) {
            $this->kill();
            throw new ProcessException("Error sending [$input] to $this stdin.", $this);
        }
    }
52299
public function valid()
    {
        if (null === $this->getManagerName()) {
            $errMsg = 'No workflow manager';
            throw new Exception\InvalidArgumentException($errMsg);
        }

        if (null === $this->getActionName()) {
            $errMsg = 'Not Specified action for workflow';
            throw new Exception\InvalidArgumentException($errMsg);
        }

        $workflowActivity = $this->getRunType();
        if (!array_key_exists($workflowActivity, $this->allowWorkflowRunType)) {
            $errMsg = sprintf('Invalid activity %s', $workflowActivity);
            throw new Exception\InvalidArgumentException($errMsg);
        }

        if (static::WORKFLOW_RUN_INITIALIZE === $workflowActivity && null === $this->getWorkflowName()) {
            $errMsg = 'Not specified name workflow';
            throw new Exception\InvalidArgumentException($errMsg);
        }

        if (static::WORKFLOW_RUN_TYPE_DO_ACTION === $workflowActivity && null === $this->getEntryId()) {
            $errMsg = 'Not specified entryId';
            throw new Exception\InvalidArgumentException($errMsg);
        }
    }
147733
protected function buildProcess()
    {
        if (!\count($this->arguments)) {
            throw new LogicException('You must add command arguments before the process can build.');
        }

        $process = new Process($this->arguments, $this->workingDirectory);

        $process->setCommandLine($process->getCommandLine());

        return $process;
    }