Validates a message according to 1.1 standard

@param  MessageInterface $message
@param  string           &$reason
@return bool
767641
public function validate0101(MessageInterface $message, &$reason = "")
    {
        // 1.1 incorporates 1.0 validation standar
        if (!$this->validate0100($message, $reason)) {
            return false;
        }

        foreach ($message->getAllAdditionals() as $key => $value) {
            if (!preg_match('#^[\w\.\-]*$#', $key)) {
                $reason = sprintf(
                    "additional key '%s' contains invalid characters",
                    $key
                );

                return false;
            }
        }

        return true;
    }
102369
public static function create($validator, $message = null)
    {
        $class = self::checkValidator($validator);

        /** @var ValidatorInterface $object */
        $object = new $class;
        if (!is_null($message)) {
            $object->setMessage($message);
        }
        return $object;
    }
399433
public function forMessage(CommitMessageInterface $message)
    {
        $filter = function ($review) use ($message) {
            if ($review->canReview($message)) {
                return true;
            }

            return false;
        };

        return $this->select($filter);
    }
361733
private function canNot(string $message, string $invalidMethod): string
    {
        if (isset($this->_voidMethods[$invalidMethod])) {
            $reason = 'is declared as returning void.';
        } elseif (method_exists($this, $invalidMethod)) {
            $reason = 'is not applicable for mapping.';
        } else {
            $reason = 'does not exist. Probably a typo?';
        }

        return sprintf(
                'Trying to %s method %s, but it %s',
                $message,
                $this->completeNameOf($invalidMethod),
                $reason
        );
    }
776165
private function messageLoggerContext(MessageInterface $message): array
    {
        return [
            'id' => $message->getId(),
            'created' => $message->getCreated(),
            'type' => $message->getType(),
            'payload' => $message->getPayload(),
        ];
    }
1209416
public function abortIf($condition, $message = '')
    {
        $message = (strlen($message)) ? $message : 'Unknown Reason';

        if (true === $condition) {
            throw new AbortException($message);
        }
    }
230321
public static function reply(InteropMessage $replyMessage, $status = self::ACK, $reason = null)
    {
        $status = null === $status ? self::ACK : $status;

        $result = new static($status, $reason);
        $result->setReply($replyMessage);

        return $result;
    }
506404
private static function buildMessage($data, string $reason): string
    {
        $template = self::getTemplate();

        $message = beautify_parse($template, [
            'value' => $data,
            'not_valid' => 'NOT VALID',
            'reason' => $reason,
        ]);

        return $message;
    }
685599
protected function validate(){
		$valid = true;
		$message = null;
		$result = ValidationResult::create($valid, $message);
		return $result;
	}
271424
public function load(Message $message) : Message
    {
        $commandReflection = new \ReflectionClass($message->getPayload());
        $aggregateIdentifiers = [];
        $expectedVersion   = null;
        foreach ($commandReflection->getProperties() as $property) {
            if (preg_match("*AggregateIdAnnotation*", $property->getDocComment())) {
                $property->setAccessible(true);
                $value = (string)$property->getValue($message->getPayload());
                if ($value) {
                    $aggregateIdentifiers[$property->getName()] = $value;
                }
            }
            if (preg_match("*AggregateExpectedVersionAnnotation*", $property->getDocComment())) {
                $property->setAccessible(true);
                $expectedVersion = $property->getValue($message->getPayload());
            }
        }

        $aggregate = null;
        if (!$this->isFactoryMethod) {
            if (!$aggregateIdentifiers) {
                throw AggregateNotFoundException::create("There is no aggregate id to search for found. Are you sure you defined AggregateId Annotation or are not aggregateIdentifiers null?");
            }

            $aggregate = is_null($expectedVersion)
                ? $this->aggregateRepository->findBy($aggregateIdentifiers)
                : $this->aggregateRepository->findWithLockingBy($aggregateIdentifiers, $expectedVersion);
        }

        $messageBuilder = MessageBuilder::fromMessage($message);
        if ($aggregate) {
            $messageBuilder = $messageBuilder->setHeader(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_HEADER, $aggregate);
        }
        if ($expectedVersion) {
            $messageBuilder = $messageBuilder->setHeader(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_EXPECTED_VERSION_HEADER, $expectedVersion);
        }

        return $messageBuilder
            ->setHeader(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_CLASS_NAME_HEADER, $this->aggregateClassName)
            ->setHeader(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_METHOD_HEADER, $this->aggregateMethod)
            ->setHeader(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_REPOSITORY_HEADER, $this->aggregateRepository)
            ->setHeader(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_ID_HEADER, $aggregateIdentifiers)
            ->setHeader(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_IS_FACTORY_METHOD_HEADER, $this->isFactoryMethod)
            ->setHeader(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_MESSAGE_HEADER, $message->getPayload())
            ->build();
    }
1032909
public function matches(MessageReceived $message): bool
    {
        $haystack = $this->values;

        if ($haystack instanceof Collection) {
            $haystack = $haystack->toArray();
        }

        return in_array($message->getText(), $haystack, false);
    }
987546
public function getMessageValidator(): ValidateMessage
    {
        $messageValidator = new ValidateMessageImplementation(
            [
                new CapitalizeTheSubjectLineValidator(),
                new DoNotEndTheSubjectLineWithAPeriodValidator(),
                new LimitTheBodyWrapLengthTo72CharactersValidator(),
                new LimitTheTitleLengthTo69CharactersValidator(),
                new SeparateSubjectFromBodyWithABlankLineValidator(),
                new SoftLimitTheTitleLengthTo50CharactersValidator(),
            ]
        );

        return $messageValidator;
    }
1148846
public static function create($validator, $message = null)
    {
        if (array_key_exists($validator, static::$validators)) {
            $class = static::$validators[$validator];
            $id = $validator;
        } else if (
        is_subclass_of($validator, 'Slick\Validator\ValidatorInterface')
        ) {
            $class = $validator;
            $id = ucfirst(str_replace("\\", "", $validator));
        } else {
            throw new Exception\UnknownValidatorClassException(
                "The validator '{$validator}' is not defined or does not " .
                "implements the Slick\\Validator\\ValidatorInterface interface"
            );
        }

        /** @var ValidatorInterface $object */
        $object = new $class;
        if (!is_null($message)) {
            $object->setMessage($id, $message);
        }

        return $object;
    }
735665
public function validate(Message $message)
    {
        if ($message->getTitleLength() > self::CHARACTER_LIMIT) {
            $message->addStatus(new SoftLimitTheTitleLengthTo50CharactersStatus());
        }
    }
891950
public function validate(Message $message)
    {
        if ($message->getBodyWrapLength() > self::WRAP_LIMIT) {
            $message->addStatus(new LimitTheBodyWrapLengthTo72CharactersStatus());
        }
    }
538563
public function send(MessageInterface $message)
    {
        if (!$message instanceof BlackberryMessage) {
            throw new InvalidMessageTypeException(sprintf("Message type '%s' not supported by Blackberry", get_class($message)));
        }

        return $this->doSend($message);
    }
1347333
public function validate(&$msg = null)
    {
        if (!isset($this->_name) && !isset($this->_value) && !isset($this->_file)) {
            return false;
        } elseif (isset($this->_file) && (isset($this->_name) || isset($this->_value))) {
            return false;
        } elseif ((isset($this->_name) && !isset($this->_value)) || (!isset($this->_name) && isset($this->_value))) {
            return false;
        } else {
            return true;
        }
    }