/** * @param SnapshotStore $snapshotStore * @param AggregateRepository[] $aggregateRepositories */ public function __construct(SnapshotStore $snapshotStore, array $aggregateRepositories) { Assertion::notEmpty($aggregateRepositories); Assertion::allIsInstanceOf($aggregateRepositories, AggregateRepository::class); $this->snapshotStore = $snapshotStore; $this->aggregateRepositories = $aggregateRepositories; }
/** * @param string $workflowName * @param string $workflowId * @return CreateWorkflow */ public static function withName($workflowName, $workflowId) { Assertion::string($workflowName); Assertion::notEmpty($workflowName); Assertion::uuid($workflowId); return new self(__CLASS__, ['workflow_id' => $workflowId, 'name' => $workflowName]); }
public function __construct($templateId, $id) { Assertion::notEmpty($templateId); Assertion::string($id); $this->id = $id; $this->templateId = $templateId; }
/** * CreateUser constructor. * * @param string $userName * @param string $password */ public function __construct($userName = '', $password = '') { Assertion::notEmpty($userName, 'Username is a required field to create a user'); Assertion::notEmpty($password, 'Password is a required field to create a user'); $this->userName = $userName; $this->password = $password; }
/** * @param string $messageName * @return string */ public static function normalize($messageName) { Assertion::notEmpty($messageName); Assertion::string($messageName); $search = array(static::MESSAGE_NAME_PREFIX, "-", "\\", "/", " "); return strtolower(str_replace($search, "", $messageName)); }
/** * @param $name */ public function __construct($name) { Assertion::string($name, 'StreamName must be a string'); Assertion::notEmpty($name, 'StreamName must not be empty'); Assertion::maxLength($name, 200, 'StreamName should not be longer than 200 chars'); $this->name = $name; }
protected function _validateIpnListeners() { Assertion::notEmpty($this->ipnListeners); foreach ($this->ipnListeners as $ipn_listener) { Assertion::isInstanceOf($ipn_listener, PaymentListener::class); } }
/** * Устанавливает описание gitlab'a * * @param string $token * * @return $this * @throws \Assert\AssertionFailedException */ public function setToken($token) { Assertion::notEmpty($token); Assertion::string($token); $this->token = $token; return $this; }
/** * Returns a project config instance. * * @param string $project Project name * * @return Config */ public function getProjectConfig($project) { Assertion::string($project); Assertion::notEmpty($project); $config = $this->configLoader->load(array($this->getConfigFilePath($project))); return $config; }
/** * AddUserToGroup constructor. * * @param string $userName * @param string $groupId */ public function __construct($userName = '', $groupId = '') { Assertion::notEmpty($userName, 'Username is a required field to add a user to a group'); Assertion::notEmpty($groupId, 'Group id is a required field to add a user to a group'); $this->userName = $userName; $this->groupId = $groupId; }
private function __construct(ExpenseListId $id, $name, AccountId $accountId) { Assertion::notEmpty($name); $this->name = $name; $this->id = $id; $this->accountId = $accountId; }
/** * ActivityTest constructor. * @param User $user * @param \DateTime $created * @param integer $activities */ public function __construct(User $user, \DateTime $created, $activities) { Assertion::integer($activities); Assertion::notEmpty($created); $this->dateTime = $created; $this->activities = $activities; $this->user = $user; }
public function getField(string $name) : Field { $fields = array_filter($this->fields, function (Field $field) use($name) : bool { return $field->getName() === $name; }); Assertion::notEmpty($fields); return reset($fields); }
/** * @param array $jsonDecodedData * @return Payload */ public static function fromJsonDecodedData(array $jsonDecodedData) { Assertion::keyExists($jsonDecodedData, 'typeClass'); Assertion::keyExists($jsonDecodedData, 'data'); Assertion::notEmpty($jsonDecodedData['typeClass']); Assertion::string($jsonDecodedData['typeClass']); return new static($jsonDecodedData['typeClass'], $jsonDecodedData['data']); }
public function consume($queue_name, Closure $message_callback) { Assertion::string($queue_name); Assertion::notEmpty($queue_name); $channel = $this->getChannel(); $channel->basic_qos(null, 1, null); $channel->basic_consume($queue_name, false, true, false, false, false, $message_callback); return $channel; }
/** * @return ReportWriterInterface */ private function getReportWriter($format) { Assertion::string($format); Assertion::notEmpty($format); if (!isset($this->reportWriters[$format])) { throw new \RuntimeException("ReportWriter for {$format} not found"); } return $this->reportWriters[$format]; }
/** * @param $content */ protected function setContent($content) { $content = trim($content); if (!$content) { throw new \InvalidArgumentException('Message cannot be empty'); } Assertion::notEmpty($content); $this->content = $content; }
public function __construct() { Assertion::notEmpty(config('apiBpm.UrlLogin'), 'Specify in the string configuration for authorization'); Assertion::notEmpty(config('apiBpm.Login'), 'The configuration is not specified login'); Assertion::notEmpty(config('apiBpm.Password'), 'The configuration is not specified password'); $this->urlLogin = config('apiBpm.UrlLogin'); $this->username = config('apiBpm.Login'); $this->password = config('apiBpm.Password'); }
/** * @param string $userName * @return integer */ public function byUsername($userName) { $view = new FilesView('/' . $userName . '/files'); $freeSpace = (int) $view->free_space(); $fileInfo = $view->getFileInfo('/'); Assertion::notEmpty($fileInfo); $usedSpace = $fileInfo->getSize(); return KiloBytes::allocateUnits($freeSpace + $usedSpace)->units(); }
/** * @param UuidInterface $id * @param int $amount * @param Product $product */ public function __construct(UuidInterface $id, $amount, Product $product) { Assertion::uuid($id->toString()); Assertion::integer($amount); Assertion::notEmpty($product); $this->id = $id; $this->amount = $amount; $this->product = $product; }
/** * @param string $name * @param float $price * @param string $currency */ public function __construct($name, $price, $currency) { Assertion::notEmpty($name); Assertion::float($price); Assertion::notEmpty($currency); $this->name = $name; $this->price = $price; $this->currency = $currency; }
/** * @param string $aPathWithKey * @param string $aValueType */ public function __construct($aPathWithKey, $aValueType) { Assertion::string($aPathWithKey); $aPathWithKey = trim($aPathWithKey); Assertion::notEmpty($aPathWithKey); Assertion::inArray($aValueType, array(StructureDefinition::BOOLEAN, StructureDefinition::INTEGER, StructureDefinition::FLOAT, StructureDefinition::STRING, StructureDefinition::COLLECTION, StructureDefinition::HASHTABLE)); $this->extractPathFromKey($aPathWithKey); $this->valueType = $aValueType; }
private function setAddress($address) { $address = trim($address); if (!$address) { throw new \InvalidArgumentException('Address cannot be empty'); } Assertion::notEmpty($address); $this->address = $address; }
/** * @param string $source * @param Prototype $prototype * @param array $metadata */ private function __construct($source, Prototype $prototype, array $metadata) { Assertion::notEmpty($source); Assertion::string($source); $this->assertMetadata($metadata); $this->source = $source; $this->prototype = $prototype; $this->metadata = $metadata; }
/** * @param string $desiredMessageName * @param MessageFactory $messageFactory * @param array $defaultPayload * @param array $defaultMetadata * @param callable|null $payloadGenerator */ public function __construct($desiredMessageName, MessageFactory $messageFactory, array $defaultPayload = [], array $defaultMetadata = [], callable $payloadGenerator = null) { Assertion::string($desiredMessageName); Assertion::notEmpty($desiredMessageName); $this->desiredMessageName = $desiredMessageName; $this->messageFactory = $messageFactory; $this->defaultPayload = $defaultPayload; $this->defaultMetadata = $defaultMetadata; $this->payloadGenerator = $payloadGenerator; }
/** * @param string $pattern * @return $this * @throws Exception\RuntimeException */ public function route($pattern) { Assertion::string($pattern); Assertion::notEmpty($pattern); if (!is_null($this->tmpPattern)) { throw new Exception\RuntimeException(sprintf("pattern %s is not mapped to a handler.", $this->tmpPattern)); } $this->tmpPattern = $pattern; return $this; }
public function __construct($value) { parent::__construct($value); try { Assertion::notEmpty($value); } catch (AssertionInvalidArgumentException $e) { throw new StrNotEmptyException($value); } $this->value = $value; }
private function __construct(PersonalInformation $personalInformation, $indication, $arrived, PatientId $id) { Assertion::string($indication); Assertion::notEmpty($indication); $this->indication = $indication; Assertion::boolean($arrived); $this->arrived = $arrived; $this->personalInformation = $personalInformation; $this->id = $id; }
/** * Constructor * * @param Queue $queue * @param Exchange[] $exchanges * @param int $waitMillis * @param string $appId */ public function __construct(Queue $queue, array $exchanges, int $waitMillis = 100, string $appId = '') { Assertion::min($waitMillis, 1); Assertion::notEmpty($exchanges, 'No exchanges given'); Assertion::allIsInstanceOf($exchanges, Exchange::class); $this->queue = $queue; $this->exchanges = $exchanges; $this->waitMillis = $waitMillis; $this->appId = $appId; }
/** * @param string $messageName * @return $this * @throws Exception\RuntimeException */ public function route($messageName) { Assertion::string($messageName); Assertion::notEmpty($messageName); if (null !== $this->tmpMessageName) { throw new Exception\RuntimeException(sprintf("Message %s is not mapped to a handler.", $this->tmpMessageName)); } $this->tmpMessageName = $messageName; return $this; }