boolean() public static method

public static boolean ( $value, $message = '' )
Esempio n. 1
0
 /**
  * @param string $variableName
  * @param Type $type
  * @param bool $isVariadic
  * @param Description $description
  */
 public function __construct($variableName, Type $type = null, $isVariadic = false, Description $description = null)
 {
     Assert::string($variableName);
     Assert::boolean($isVariadic);
     $this->variableName = $variableName;
     $this->type = $type;
     $this->isVariadic = $isVariadic;
     $this->description = $description;
 }
Esempio n. 2
0
 /**
  * Fetch the result of the modulus check on the account.
  *
  * @param bool $assume Result to use if the account could not be validated.
  *
  * @return bool True if details are usable
  */
 public function isValid($assume = true)
 {
     try {
         Assert::boolean($assume, 'assume should be a boolean, got: `%s`');
     } catch (\InvalidArgumentException $e) {
         throw E::wrap($e);
     }
     return $this->specKnown ? $this->specResult : $assume;
 }
Esempio n. 3
0
 /**
  * Create a Serializer instance.
  *
  * @param int $indent The number of times the indent string is repeated.
  * @param string   $indentString    The string to indent the comment with.
  * @param bool     $indentFirstLine Whether to indent the first line.
  * @param int|null $lineLength The max length of a line or NULL to disable line wrapping.
  */
 public function __construct($indent = 0, $indentString = ' ', $indentFirstLine = true, $lineLength = null)
 {
     Assert::integer($indent);
     Assert::string($indentString);
     Assert::boolean($indentFirstLine);
     Assert::nullOrInteger($lineLength);
     $this->indent = $indent;
     $this->indentString = $indentString;
     $this->isFirstLineIndented = $indentFirstLine;
     $this->lineLength = $lineLength;
 }
Esempio n. 4
0
 public function __construct($methodName, array $arguments = [], Type $returnType = null, $static = false, Description $description = null)
 {
     Assert::stringNotEmpty($methodName);
     Assert::boolean($static);
     if ($returnType === null) {
         $returnType = new Void();
     }
     $this->methodName = $methodName;
     $this->arguments = $this->filterArguments($arguments);
     $this->returnType = $returnType;
     $this->isStatic = $static;
     $this->description = $description;
 }
Esempio n. 5
0
 /**
  * @param string $summary
  * @param DocBlock\Description $description
  * @param DocBlock\Tag[] $tags
  * @param Context $context The context in which the DocBlock occurs.
  * @param Location $location The location within the file that this DocBlock occurs in.
  * @param bool $isTemplateStart
  * @param bool $isTemplateEnd
  */
 public function __construct($summary = '', DocBlock\Description $description = null, array $tags = [], Context $context = null, Location $location = null, $isTemplateStart = false, $isTemplateEnd = false)
 {
     Assert::string($summary);
     Assert::boolean($isTemplateStart);
     Assert::boolean($isTemplateEnd);
     $this->summary = $summary;
     $this->description = $description ?: new DocBlock\Description('');
     foreach ($tags as $tag) {
         $this->addTag($tag);
     }
     $this->context = $context;
     $this->location = $location;
     $this->isTemplateEnd = $isTemplateEnd;
     $this->isTemplateStart = $isTemplateStart;
 }
Esempio n. 6
0
 /**
  * Returns all options added to the builder.
  *
  * @param bool $includeBase Whether to include options of the base format
  *                          in the result.
  *
  * @return Option[] The options.
  */
 public function getOptions($includeBase = true)
 {
     Assert::boolean($includeBase, 'The parameter $includeBase must be a boolean. Got: %s');
     $options = $this->options;
     if ($includeBase && $this->baseFormat) {
         // append base options
         $options = array_replace($options, $this->baseFormat->getOptions());
     }
     return $options;
 }
Esempio n. 7
0
 /**
  * Sets whether the application is in debug mode.
  *
  * In debug mode, the verbosity is always {@link IO::DEBUG}.
  *
  * @param bool $debug Set to `true` to activate the debug mode.
  *
  * @return static The current instance.
  *
  * @see isDebug()
  */
 public function setDebug($debug)
 {
     Assert::boolean($debug);
     $this->debug = $debug;
     return $this;
 }
Esempio n. 8
0
 /**
  * {@inheritdoc}
  */
 public function setTracked($tracked)
 {
     Assert::boolean($tracked);
     $this->tracked = $tracked;
 }
Esempio n. 9
0
 /**
  * Returns whether the format contains options.
  *
  * @param bool $includeBase Whether to include options in the base format
  *                          in the search.
  *
  * @return bool Returns `true` if the format contains options and `false`
  *              otherwise.
  */
 public function hasOptions($includeBase = true)
 {
     Assert::boolean($includeBase, 'The parameter $includeBase must be a boolean. Got: %s');
     if (count($this->options) > 0) {
         return true;
     }
     if ($includeBase && $this->baseFormat) {
         return $this->baseFormat->hasOptions();
     }
     return false;
 }
Esempio n. 10
0
 /**
  * Creates a new repository.
  *
  * @param string            $baseDir      The base directory of the repository on the file
  *                                        system.
  * @param bool              $symlink      Whether to use symbolic links for added files. If
  *                                        symbolic links are not supported on the current
  *                                        system, the repository will create hard copies
  *                                        instead.
  * @param bool              $relative     Whether to create relative symbolic links. If
  *                                        relative links are not supported on the current
  *                                        system, the repository will create absolute links
  *                                        instead.
  * @param ChangeStream|null $changeStream If provided, the repository will log
  *                                        resources changes in this change stream.
  */
 public function __construct($baseDir = '/', $symlink = true, $relative = true, ChangeStream $changeStream = null)
 {
     parent::__construct($changeStream);
     Assert::directory($baseDir);
     Assert::boolean($symlink);
     $this->baseDir = rtrim(Path::canonicalize($baseDir), '/');
     $this->baseDirLength = strlen($baseDir);
     $this->symlink = $symlink && self::isSymlinkSupported();
     $this->relative = $this->symlink && $relative;
     $this->filesystem = new Filesystem();
 }
 /**
  * Creates a new repository.
  *
  * @param string $baseDir  The base directory of the repository on the file
  *                         system.
  * @param bool   $symlink  Whether to use symbolic links for added files. If
  *                         symbolic links are not supported on the current
  *                         system, the repository will create hard copies
  *                         instead.
  * @param bool   $relative Whether to create relative symbolic links. If
  *                         relative links are not supported on the current
  *                         system, the repository will create absolute links
  *                         instead.
  */
 public function __construct($baseDir = '/', $symlink = true, $relative = true)
 {
     Assert::directory($baseDir);
     Assert::boolean($symlink);
     $this->baseDir = rtrim(Path::canonicalize($baseDir), '/');
     $this->symlink = $symlink && self::isSymlinkSupported();
     $this->relative = $this->symlink && $relative;
     $this->filesystem = new Filesystem();
 }