Check specification requirement.

@return bool
492198
public function check(): bool
    {
        $path = \app()->storagePath();

        $this->description = Str::replace($this->description, \compact('path'));

        return $this->checkPathIsWritable($path);
    }
91085
public function check() {
		foreach ( $this->requirements as $requirement ) {
			// Match against config.
			$requirementFulfilled = $this->requirementIsFulfilled( $requirement );

			if ( $requirementFulfilled ) {
				continue;
			}

			$this->addMissingRequirementMessage( $requirement );
		}
	}
845324
protected static function checkRequirements()
    {
        if (self::$enabledPharData === null || self::$enabledPearTar === null) {
            self::$enabledPearTar = class_exists('\Archive_Tar');
            self::$enabledPharData = class_exists('\PharData');
        }
    }
1173488
private function validateRequirements()
    {
        // enough options to proceed
        if(!$this->option('all')) {
            $enoughOptions = false;
            foreach ($this->defaultsOptions as $app => $nr) {
                if($this->option($app)) {
                    $enoughOptions = true;
                    break;
                }
            }

            if(!$enoughOptions) {
                $this->error('No options given! Write --all=1 to create dummy for all default apps, or write --{APP NAME}={NUMBER OF DUMMIES TO CREATE} to proceed!');
                return false;
            }
        }

        // Ensure there is at least one user
        if(!User::count()) {
            $this->error('No Users found. Create a user with "make:user {email} {password}" command to proceed!');
            return false;
        }

        // Ensure there is at least one langauge
        if(!Language::count()) {
            $this->error('No languages found. Create a langauge manually via Admin interface to proceed!');
            return false;
        }

        return true;
    }
1173428
protected function check_indicators_requirements() {

        foreach ($this->indicators as $indicator) {
            $missingrequired = $this->check_indicator_requirements($indicator);
            if ($missingrequired !== true) {
                throw new \core_analytics\requirements_exception(get_class($indicator) . ' indicator requires ' .
                    json_encode($missingrequired) . ' sample data which is not provided by ' . get_class($this));
            }
        }
    }
597952
public function isRequired()
    {
        $result = $this->required;
        if (is_callable($result)) {
            $result = $result($this);
        }

        return (bool) $result;
    }
863211
function check_requisites() {
        global $CFG;

        $this->requisitesok = false;

    /// Check that everything we need is present
        if (empty($this->sourcebase) || empty($this->zipfilename)) {
            $this->errorstring='missingrequiredfield';
            return false;
        }
    /// Check for correct sourcebase (this will be out in the future)
        if (!PHPUNIT_TEST and $this->sourcebase != 'https://download.moodle.org') {
            $this->errorstring='wrongsourcebase';
            return false;
        }
    /// Check the zip file is a correct one (by extension)
        if (stripos($this->zipfilename, '.zip') === false) {
            $this->errorstring='wrongzipfilename';
            return false;
        }
    /// Check that exists under dataroot
        if (!empty($this->destpath)) {
            if (!file_exists($CFG->dataroot.'/'.$this->destpath)) {
                $this->errorstring='wrongdestpath';
                return false;
            }
        }
    /// Calculate the componentname
        $pos = stripos($this->zipfilename, '.zip');
        $this->componentname = substr($this->zipfilename, 0, $pos);
    /// Calculate md5filename if it's empty
        if (empty($this->md5filename)) {
            $this->md5filename = $this->componentname.'.md5';
        }
    /// Set the requisites passed flag
        $this->requisitesok = true;
        return true;
    }
519118
public function isValidExtension()
    {
        return !count($this->allowedExtensions)
            || in_array($this->getFileExtension(), $this->allowedExtensions, true);
    }
654805
public function areReturnTypesWellKnown()
    {
        if (0 == $this->count() || $this->isSatisfiedByTypeSpec(new Specification\IsSpecial())) {
            return false;
        }

        $spec =
            (new Specification\ObjectLike())
            ->either(new Specification\ArrayCompatible())
            ->either(new Specification\IntCompatible())
            ->either(new Specification\StringCompatible())
            ->either(new Specification\IsBool())
            ->either(new Specification\IsDouble())
            ->either(new Specification\IsNull())
            // TODO: Please double check this
            ->either(new Specification\IsVoid());

        $found = $this->getTypesBySpecification($spec);

        return \count($found) == $this->count();
    }
863432
protected function checkRequirements()
    {
        $required_properties = array('_buildFile');
        foreach ($required_properties as $required_property) {
            if (empty($this->$required_property)) {
                throw new \BuildException(
                    "Missing required property '" . $required_property . "'."
                );
            }
        }
    }
192093
public function isRequired()
    {
        $isRequired = false;

        // see if on the first level of fields we have a required=true in the definition
        foreach ($this->fields as $field) {
            if ($field instanceof JsonDefinitionField &&
                $field->getDef() instanceof Field &&
                $field->getDef()->getRequired() === true
            ) {
                $isRequired = true;
            }
        }

        return $isRequired;
    }
1054845
public function validatePrerequisites() {
        try {
            Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
            
            return !is_null(Module::getModuleByName(Constants::MODULE_MAJ_SOSA_NAME));
        }
        catch (\Exception $ex) {  }
        return false;
    }
816136
protected static function checkRequirements()
    {
        if (empty(self::$enabledTypes)) {
            self::$enabledTypes[self::ZIP] = extension_loaded('zip');
            self::$enabledTypes[self::SEVEN_ZIP] = class_exists('\Archive7z\Archive7z');
            self::$enabledTypes[self::RAR] = extension_loaded('rar');
            self::$enabledTypes[self::GZIP] = extension_loaded('zlib');
            self::$enabledTypes[self::BZIP] = extension_loaded('bz2');
            self::$enabledTypes[self::LZMA] = extension_loaded('xz');
            self::$enabledTypes[self::ISO] = class_exists('\CISOFile');
            self::$enabledTypes[self::CAB] = class_exists('\CabArchive');
            self::$enabledTypes[self::TAR] = class_exists('\Archive_Tar') || class_exists('\PharData');
            self::$enabledTypes[self::TAR_GZIP] = (class_exists('\Archive_Tar') || class_exists('\PharData')) && extension_loaded('zlib');
            self::$enabledTypes[self::TAR_BZIP] = (class_exists('\Archive_Tar') || class_exists('\PharData')) && extension_loaded('bz2');
            self::$enabledTypes[self::TAR_LZMA] = class_exists('\Archive_Tar') && extension_loaded('lzma2');
            self::$enabledTypes[self::TAR_LZMA] = class_exists('\Archive_Tar') && LzwStreamWrapper::isBinaryAvailable();
        }
    }
1303794
public function isRequired() : Group
    {
        foreach ((array)$this as $el) {
            if (!is_object($el)) {
                continue;
            }
            $el->getElement()->attribute('required', 1);
        }
        return $this->addTest('required', function ($value) {
            foreach ($value as $option) {
                if ($option->getElement() instanceof Radio
                    && $option->getElement()->checked()
                ) {
                    return true;
                }
            }
            return false;
        });
    }
71737
protected function isDrupalVmRequired() {
    $composer_json = json_decode(file_get_contents($this->getConfigValue('repo.root') . '/composer.json'), TRUE);
    return !empty($composer_json['require-dev']['geerlingguy/drupal-vm'])
      && $composer_json['require-dev']['geerlingguy/drupal-vm'] == $this->drupalVmVersionConstraint;
  }
200470
public function validate() {
		$required = array_filter($this->orig, function($spec) {
			return $spec[3] & self::REQUIRED;
		});
		foreach ($required as $req) {
			if ($req[3] & self::MULTI) {
				if (is_array($this[$req[0]])) {
					continue;
				}
			} elseif (strlen($this[$req[0]])) {
				continue;
			}
			if (is_numeric($req[0])) {
				yield sprintf("Argument <%s> is required", $req[1]);
			} else {
				yield sprintf("Option --%s is required", $req[1]);
			}
		}
	}
1185796
protected function checkRequirements() {
    if (!$this->getInspector()->commandExists("vagrant")) {
      $this->logger->error("Vagrant is not installed.");
      $this->say("Please install all dependencies for Drupal VM by following the Quickstart Guide:");
      $this->say("https://github.com/geerlingguy/drupal-vm#quick-start-guide");
      throw new BltException("Drupal VM requirements are missing.");
    }
    else {
      $this->installVagrantPlugin('vagrant-hostsupdater');
    }
  }