Validate a properties value.

@param bool $notify True to log any validation errors. Defaults to false.

@return bool|array True if the values are valid, otherwise an array of errors per JsonSchema\Validator::getErrors().
543670
public function validate($notify = false)
    {
        $validator = $this->getValidator();
        if ($validator) {
            // Expand the schema.
            // TODO: recurse & $value->validate() instead?
            $schema = clone $this->schema;
            $this->resolver->resolve($schema, $this->schema_path);

            // Set to current values.
            $values = $this->flatValue();
            if (isset($values)) {
                $validator->check($values, $schema);
                if (!$validator->isValid()) {
                    $errors = $validator->getErrors();
                    if (empty($errors)) {
                        // Create a top level schema error since something is wrong.
                        $errors = array(array(
                            'property' => $this->schema_path,
                            'message' => 'The JSON schema failed validation.',
                            'constraint' => null,
                        ));
                    }

                    // Log errors.
                    if ($notify) {
                        foreach ($errors as $error) {
                            $error_keys = array(
                              '%name' => $this->schema_name,
                              '%message' => $error['message'],
                              '%property' => isset($error['property']) ? $error['property'] : 'property',
                              '%constraint' => isset($error['constraint']) ? $error['constraint'] : 'unknown',
                            );

                            $this->logger->notice('Schema Validation: "%message" in schema "%name", property "%property" for constraint %constraint', $error_keys);
                        }
                    }

                    return $errors;
                }
            }
        }

        return true;
    }
873816
public function getValidationMessages($property = null) {
		if ($this->_validatorsMessages === null) {
			return;
		}
		
		if ($property === null) {
			return $this->_validatorsMessages;
		}
		
		if (isset($this->_validatorsMessages[$property])) {
			return $this->_validatorsMessages[$property];
		}
	}
219379
function validate($value, $key, $fields, $options, $exists, \CharlotteDunois\Validation\Validator $validator) {
        if(!$exists) {
            return false;
        }
        
        if(empty($options)) {
            $options = 'confirmation';
        }
        
        if(!isset($fields[$key.'_'.$options]) || $fields[$key] !== $fields[$key.'_'.$options]) {
            return 'formvalidator_make_confirmed';
        }
        
        return true;
    }
561681
public function validate(array $data) : bool
    {
        $passed = true;
        $this->invalidFields = [];
        $rules = $this->getRules();
        foreach ($rules as $validation => $fields) {
            foreach ($fields as $key => $value) {
                $field = $this->getFieldInfo($key, $value);
                $validationInstance = $this->getValidation($validation);
                $validationStatus = $validationInstance->run($field, $data);
                $passed = $passed && $validationStatus;
                $this->invalidFields = array_merge_recursive(
                        $this->invalidFields, $validationInstance->getMessages()
                );
            }
        }
        return $passed;
    }
855798
public function terminate( $model, $notify = true, $config = [] ) {

		if( !$model->isTerminated( true ) ) {

			$model = $this->updateStatus( $model, IApproval::STATUS_TERMINATED );

			if( $notify ) {

				$title = ucfirst( self::$parentType ) . ' - ' . $model->getClassName() . ' - Terminated';

				$config[ 'template' ] = CoreGlobal::TPL_NOTIFY_STATUS_TERMINATE;
				$config[ 'data' ][ 'message' ] = $model->getTerminateMessage();

				$this->notifyUser( $model, $config, $title );
			}

			return $model;
		}

		return false;
	}
997713
public function getProperty($key, $notifyWarnings = true)
  {
    if (!(isset($this->configSettings[$key])) && $notifyWarnings) {
      echo 'MB_Configuration->getProperty() - Warning: "' . $key . '" not defined.', PHP_EOL;
      $callers = debug_backtrace();
      echo '- Called from: ' . $callers[1]['function'], PHP_EOL;
      return false;
    } elseif (!(isset($this->configSettings[$key]))) {
      return false;
    }
    return $this->configSettings[$key];
  }
743656
protected function validateInputs(array $values, $logLevel = Logger::ERROR)
    {
        $isValid = true;
        if (array_key_exists(self::USER_ID, $values)) {
            // Empty str is a valid user ID
            if (!is_string($values[self::USER_ID])) {
                $this->_logger->log(Logger::ERROR, sprintf(Errors::INVALID_FORMAT, self::USER_ID));
                $isValid = false;
            }
            unset($values[self::USER_ID]);
        }

        foreach ($values as $key => $value) {
            if (!Validator::validateNonEmptyString($value)) {
                $isValid = false;
                $message = sprintf(Errors::INVALID_FORMAT, $key);
                $this->_logger->log($logLevel, $message);
            }
        }

        return $isValid;
    }
774872
public function softDeleteNotify( $model, $notify = true, $config = [] ) {

		if( !$model->isDeleted( true ) ) {

			$model = $this->updateStatus( $model, IApproval::STATUS_DELETED );

			if( $notify ) {

				$title = ucfirst( self::$parentType ) . ' - ' . $model->getClassName() . ' - Deleted';

				$config[ 'template' ] = CoreGlobal::TPL_NOTIFY_STATUS_DELETE;

				$this->notifyUser( $model, $config, $title );
			}

			return $model;
		}

		return false;
	}
481322
protected function validateProperty(string $property, bool $needed = false)
    {
        if (!property_exists($this, $property)) {
            throw new InvalidArgumentException("Property {$property} does not exist");
        }

        if ($needed && !isset($this->{$property})) {
            throw new LogicException("Property {$property} could not be calculated");
        }

        return $this;
    }
480842
protected function validValue(&$val)
    {
        if (!is_array($val)) {
            return $val == null || is_scalar($val) || $val instanceof JsonSerializable;
        }

        foreach ($val as $k => $v) {
            if (!$this->validValue($v)) {
                $val[$k] = null;
            } else {
                $val[$k] = $v;
            }
        }
        return true;
    }
619596
public function isValid($value)
    {
        if (!is_string($value)) {
            $this->error(self::INVALID);
            return false;
        }

        $this->setValue($value);
        if (!preg_match(self::PATTERN, $value)) {
            $this->error(self::NOT_MATCH);
            return false;
        }

        if (!$this->getCurrencyList()->isAllowed($value)) {
            $this->error(self::NOT_FOUND);
        }

        return count($this->getMessages()) === 0;
    }
939348
protected function isValid($value)
    {
        if ($value === null) {
            $this->addError('This property is required.', 1221560910);
        }
        if ($value === '') {
            $this->addError('This property is required.', 1221560718);
        }
        if (is_array($value) && empty($value)) {
            $this->addError('This property is required', 1354192543);
        }
        if (is_object($value) && $value instanceof \Countable && $value->count() === 0) {
            $this->addError('This property is required.', 1354192552);
        }
    }
491816
protected function validatePropertyType(string $property, string $type) : bool
    {
        list($type, $arg) = $this->parseType($type);

        switch ($type) {
            case 'any':
            case 'notnull':
            case 'isset':
            case 'set':
                return true;
            case 'string':
                return is_string($this->{$property});
            case 'email':
                return filter_var($this->{$property}, FILTER_VALIDATE_EMAIL) !== false;
            case 'url':
                return filter_var($this->{$property}, FILTER_VALIDATE_URL) !== false;
            case 'int':
                return is_int($this->{$property});
            case 'bool':
            case 'boolean':
                return is_bool($this->{$property});
            case 'array':
                return is_array($this->{$property});
            case 'null':
                return $this->{$property} === null;
            case 'is_a':
                return is_a($this->{$property}, $arg, true);
            case 'is':
                return is_a($this->{$property}, $arg);
            case 'instanceof':
                return $this->{$property} instanceof $arg;
            default:
                throw new \InvalidArgumentException("{$type} is not a recognised type");
        }
    }
402192
public function isValid($json=null) {
			if (empty($json) || ctype_space($json)) return false;
			json_decode($json);
			return (json_last_error() === JSON_ERROR_NONE);
		}
1011805
protected function validateValue($property, $value)
    {
        $this->isPropertyValid($property);

        $regEx = '/^' . self::CONFIRMATION_PROPERTIES[$property] . '$/';

        if (preg_match($regEx, $value) != 1) {
            throw new InvalidArgumentException("The value " . $value . " for the property " . $property . ", is invalid");
        }

        return $value;
    }
147515
public function validate($value)
    {
        return is_bool($value) ? Ok::unit() : Error::unit([ Error::NON_BOOL ]);
    }
1052403
public function markFailed($notify = true) {
		$this->Status = 'Failed';
		$this->log('Marking pipeline step as failed. See earlier log messages to determine cause.');
		$this->write();
		$this->Pipeline()->markFailed($notify);
	}