Esempio n. 1
0
 /**
  * Class constructor.
  * Initializes the error handler.
  * @param \Brickoo\Component\Messaging\MessageDispatcher $messageDispatcher
  * @param boolean $convertToException flag to convert errors to exceptions
  */
 public function __construct(MessageDispatcher $messageDispatcher, $convertToException = true)
 {
     Assert::isBoolean($convertToException);
     $this->messageDispatcher = $messageDispatcher;
     $this->convertToException = $convertToException;
     $this->isRegistered = false;
 }
Esempio n. 2
0
 /**
  * Class constructor.
  * @param string $cacheDirectory the directory used for the cache operations
  * @param boolean $serializeCacheContent flag to serialize the content cached
  * @param string $cacheFileNameSuffix the suffix to add to caching file names
  * @throws \InvalidArgumentException if an argument is not valid
  */
 public function __construct($cacheDirectory, $serializeCacheContent = true, $cacheFileNameSuffix = ".cache")
 {
     Assert::isString($cacheDirectory);
     Assert::isBoolean($serializeCacheContent);
     Assert::isString($cacheFileNameSuffix);
     $this->cacheDirectory = rtrim($cacheDirectory, "\\/") . DIRECTORY_SEPARATOR;
     $this->serializeCacheContent = $serializeCacheContent;
     $this->cacheFileNameSuffix = $cacheFileNameSuffix;
 }
 /**
  * Class constructor.
  * @param string $name
  * @param string $type
  * @param boolean $required
  * @throws \InvalidArgumentException
  */
 public function __construct($name, $type, $required = true)
 {
     Assert::isString($name);
     Assert::isString($type);
     Assert::isBoolean($required);
     $this->name = $name;
     $this->type = $type;
     $this->required = $required;
 }
Esempio n. 4
0
 /**
  * @param string $filename
  * @param integer $mode
  * @param boolean $useIncludePath
  * @param array $context
  * @throws \InvalidArgumentException
  */
 public function __construct($filename, $mode, $useIncludePath = false, array $context = array())
 {
     Assert::isString($filename);
     Assert::isInteger($mode);
     Assert::isBoolean($useIncludePath);
     $this->filename = $filename;
     $this->mode = $mode;
     $this->useIncludePath = $useIncludePath;
     $this->context = $context;
 }
 /**
  * Class constructor.
  * @param string $annotationName
  * @param integer $target
  * @param boolean $required
  * @throws \InvalidArgumentException
  */
 public function __construct($annotationName, $target = Annotation::TARGET_CLASS, $required = true)
 {
     Assert::isString($annotationName);
     Assert::isInteger($target);
     Assert::isBoolean($required);
     $this->target = $target;
     $this->annotationName = $annotationName;
     $this->required = $required;
     $this->requiredParameters = [];
     $this->optionalParameters = [];
 }
Esempio n. 6
0
 /**
  * Class constructor.
  * @param string $routingPath the routing directory path
  * @param string $routingFilename the route filename to look for
  * @param boolean $searchRecursively flag to search recursively
  * @throws \InvalidArgumentException if an argument is not valid
  */
 public function __construct($routingPath, $routingFilename, $searchRecursively = false)
 {
     Assert::isString($routingPath);
     Assert::isString($routingFilename);
     Assert::isBoolean($searchRecursively);
     if (empty($routingPath)) {
         throw new InvalidArgumentException("The routing path cannot be empty.");
     }
     if (empty($routingFilename)) {
         throw new InvalidArgumentException("The routing filename cannot be empty.");
     }
     $this->routingPath = $routingPath;
     $this->routingFilename = $routingFilename;
     $this->searchRecursively = $searchRecursively;
 }
Esempio n. 7
0
 /**
  * @covers Brickoo\Component\Common\Assert::isBoolean
  * @expectedException \InvalidArgumentException
  */
 public function testIsBooleanThrowsInvalidArgumentException()
 {
     Assert::isBoolean(null);
 }
Esempio n. 8
0
 /**
  * Sets the read only mode for all registrations.
  * True to allow read only, write operations will be not allowed.
  * False for enable read and write operations, locked identifiers will still being locked .
  * @param boolean $mode the mode to set
  * @return \Brickoo\Component\Common\Registry
  */
 public function setReadOnly($mode = true)
 {
     Assert::isBoolean($mode);
     $this->readOnly = $mode;
     return $this;
 }
 /**
  * Enable or disable http only.
  * @param boolean $httpOnly
  * @throws \InvalidArgumentException
  * @return \Brickoo\Component\Http\Header\SetCookieHeaderField
  */
 public function setHttpOnly($httpOnly)
 {
     Assert::isBoolean($httpOnly);
     $this->httpOnly = $httpOnly;
     return $this;
 }
Esempio n. 10
0
 /**
  * Sets the session cookie parameters.
  * @param integer $lifetime the cookie/session lifetime
  * @param string $path the request path to listen to
  * @param string $domain the domain to listen to
  * @param boolean $secure only should be sent while on https mode
  * @param boolean $httpOnly restriction to the http protocol
  * @throws \InvalidArgumentException if an argument is not valid
  * @throws \Brickoo\Component\Session\Exception\SessionAlreadyStartedException
  * @return \Brickoo\Component\Session\SessionManager
  */
 public function setCookieParams($lifetime, $path, $domain, $secure = false, $httpOnly = false)
 {
     Assert::isInteger($lifetime);
     Assert::isString($path);
     Assert::isString($domain);
     Assert::isBoolean($secure);
     Assert::isBoolean($httpOnly);
     $this->checkSessionStart();
     session_set_cookie_params($lifetime, $path, $domain, $secure, $httpOnly);
     return $this;
 }