Verifie la validite du repertoire.

Verifie si il existe, est un repertoire non vide

@param bool $need_not_empty rajoute une condition de validation, le repertoire ne peut etre vide

@return bool true si le repertoire est utilisable
779221
public function check_dir( $need_not_empty = true )
    {
	$ok = false;

	if( is_dir( $this->_dir_path ) && is_readable( $this->_dir_path ) ) 
	{
	    $ok = true;
	    if( $need_not_empty )
	    {
		$ok = ( count( scandir( $this->_dir_path ) ) > 0 ) ? true: false;
	    }
	}
	return $ok;
    }
748565
public function setRequired($required)
    {
        $this->required = (boolean) $required;
        if ($this->isRequired()) {
            $this->setAttribute('required');
            return $this;
        }

        if ($this->getAttributes()->containsKey('required')) {
                $this->getAttributes()->remove('required');
        }
        return $this;
    }
571458
public function hasValidNewValue()
    {
        $value = $this->getNewValue();

        if (is_null($value) || false === $value) {
            return false;
        }

        if (is_string($value)) {
            return !is_empty_string($value);
        }

        return true;
    }
162782
public function isValid()
    {
        // these schemes are allowed
        $allowedSchemes = $this->getAllowedSchemes();

        // get the field value
        $url = $this->field->getValue();


        // not required and empty? Then its valid
        if ($this->isNotRequiredAndEmpty($url)) {
            return true;
        }

        if ($this->getMaxLength() && strlen($url) > $this->getMaxLength()) {
            // Over maximum length.
            return false;
        }

        // do simple validation
        if (!filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED | FILTER_FLAG_SCHEME_REQUIRED)) {
            return false;
        }

        // check if we have a tld
        if (!$this->isSkipTldCheck() && !preg_match('#\.[a-z]{2,}$#', parse_url($url, PHP_URL_HOST))) {
            return false;
        }

        // further validation is required.
        if (in_array(parse_url($url, PHP_URL_SCHEME), $allowedSchemes)) {
            return true;
        }

        return false;
    }
929514
public function checkRequirements()
    {
        // Iterate over properties and check if they are set and not null
        $errors = array();
        foreach ( $this->requiredProperties as $property )
        {
            if ( !isset( $this->storage->$property ) ||
                 ( $this->storage->$property === null ) )
            {
                $errors[] = $property;
            }
        }

        // If error array is still empty all requirements are met
        if ( $errors === array() )
        {
            return true;
        }

        // Otherwise return the array with errors
        return $errors;
    }
1069676
protected function validateRequirementsInstall()
    {
        if ($this->isExcluded('requirements')) {
            return null;
        }

        if ($this->config->isInitialized()) {
            $error = $this->translation->text('System already installed');
            $this->setError('installed', $error);
            return false;
        }

        $requirements = $this->install->getRequirements();
        $errors = $this->install->getRequirementErrors($requirements);

        if (empty($errors['danger'])) {
            return true;
        }

        $messages = array();
        $messages[] = $this->translation->text('Please fix all critical errors in your environment');

        foreach ($requirements as $items) {
            foreach ($items as $name => $info) {
                if (in_array($name, $errors['danger'])) {
                    $status = empty($info['status']) ? $this->translation->text('No') : $this->translation->text('Yes');
                    $messages[] = " {$info['message']} - $status";
                }
            }
        }

        $this->setError('requirements', implode(PHP_EOL, $messages));
        return false;
    }
410261
public function verify(SignedJwt $jwt, VerificationContext $verificationContext, array &$errors) : bool
    {
        $verifiers = [
            new SignatureVerifier($verificationContext->getSigner()),
            new AudienceVerifier($verificationContext->getAudience()),
            new ExpirationVerifier(),
            new NotBeforeVerifier(),
            new IssuerVerifier($verificationContext->getIssuer()),
            new SubjectVerifier($verificationContext->getSubject())
        ];
        $isVerified = true;

        /** @var IVerifier $verifier */
        foreach ($verifiers as $verifier) {
            $error = '';

            if (!$verifier->verify($jwt, $error)) {
                $isVerified = false;
                $errors[] = $error;
            }
        }

        return $isVerified;
    }
1262417
public function setRequired(bool $required) : self
    {
        $required = (bool)$required;
        $this->required = $required;
        return $this;
    }
78820
public function required() {
        $this->check_role = 'require';
        $result = !empty($this->value) || '0' == $this->value;
        $this->checkResult($result);
        return $this;
    }
427030
public function hasError()
    {
        if (empty($this->validation_errors)) {
            return false;
        }
        foreach ($this->validation_errors as $v) {
            foreach ($v as $w) {
                if ($w) {
                    return true;
                }
            }
        }
        return false;
    }
324089
public static function validate($changeFreq)
    {
        if (\in_array(\trim(\strtolower($changeFreq)), self::$changeFreqValid, true)) {
            return \htmlentities($changeFreq);
        }

        return false;
    }
1148820
function validateIsRequired()
    {
        $classAttribute = $this->contentClassAttribute();
        $validationParameters = $this->validationParameters();
        if ( !( isset( $validationParameters['skip-isRequired'] ) && $validationParameters['skip-isRequired'] === true ) && $classAttribute->attribute( "is_required" ) )
            return true;

        return false;
    }
156370
public function validateRequest(): bool
    {
        if ($this->useNativeSession) {
            if (!isset($_SESSION[$this->sessionIndex])) {
                return false;
            }
            /** @var array<string, array<string, mixed>> $sess */
            $sess =& $_SESSION[$this->sessionIndex];
        } else {
            if (!isset($this->session[$this->sessionIndex])) {
                return false;
            }
            /** @var array<string, array<string, mixed>> $sess */
            $sess =& $this->session[$this->sessionIndex];
        }

        if (
            empty($this->post[$this->formIndex]) ||
            empty($this->post[$this->formToken])
        ) {
            // User must transmit a complete index/token pair
            return false;
        }

        // Let's pull the POST data
        /** @var string $index */
        $index = $this->post[$this->formIndex];
        /** @var string $token */
        $token = $this->post[$this->formToken];
        if (!\is_string($index) || !\is_string($token)) {
            return false;
        }

        if (!isset($sess[$index])) {
            // CSRF Token not found
            return false;
        }

        if (!\is_string($index) || !\is_string($token)) {
            return false;
        }

        // Grab the value stored at $index
        /** @var array<string, mixed> $stored */
        $stored = $sess[$index];

        // We don't need this anymore
        if ($this->deleteToken($sess[$index])) {
            unset($sess[$index]);
        }

        // Which form action="" is this token locked to?
        /** @var string $lockTo */
        $lockTo = $this->server[$this->lock_type];
        if (\preg_match('#/$#', $lockTo)) {
            // Trailing slashes are to be ignored
            $lockTo = Binary::safeSubstr(
                $lockTo,
                0,
                Binary::safeStrlen($lockTo) - 1
            );
        }

        if (!\hash_equals($lockTo, (string) $stored['lockTo'])) {
            // Form target did not match the request this token is locked to!
            return false;
        }

        // This is the expected token value
        if ($this->hmac_ip === false) {
            // We just stored it wholesale
            /** @var string $expected */
            $expected = $stored['token'];
        } else {
            // We mixed in the client IP address to generate the output
            /** @var string $expected */
            $expected = Base64UrlSafe::encode(
                \hash_hmac(
                    $this->hashAlgo,
                    isset($this->server['REMOTE_ADDR'])
                        ? (string) $this->server['REMOTE_ADDR']
                        : '127.0.0.1',
                    (string) Base64UrlSafe::decode((string) $stored['token']),
                    true
                )
            );
        }
        return \hash_equals($token, $expected);
    }
686629
public function hasRequirement($object, $requirement = null)
    {
        return isset($this->requirements[$object])
            && ($requirement === null || in_array($requirement, $this->requirements[$object], true));
    }
343387
public function has_required_properties() {

        return (
            ! empty( $this->plural_name )
            && ! empty( $this->post_type )
            && ! empty( $this->singular_name )
            && ! empty( $this->slug )
        );

    }
1181726
public function required($required = true, $required_value = true)
    {
        if ($required == $required_value) {
            $this->addClass('required');
            $this->aria('required', 'true');

            return parent::attr('required', 'required');
        }

        return $this;
    }
190259
public static function validate( $the__file__, array $requirements = array() ) {
		$_wpr = new WP_Requirements( $the__file__, $requirements );

		$is_valid = $_wpr->valid();

		if ( ! $is_valid ) {
			$_wpr->process_failure();
		}

		return $is_valid;
	}