当前位置: 首页>>代码示例>>PHP>>正文


PHP InvalidArgumentException类代码示例

本文整理汇总了PHP中InvalidArgumentException的典型用法代码示例。如果您正苦于以下问题:PHP InvalidArgumentException类的具体用法?PHP InvalidArgumentException怎么用?PHP InvalidArgumentException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了InvalidArgumentException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: validation

 public function validation($ruleName, $value)
 {
     Cascade::getLogger('bigc\\profile')->debug("ProfileData validation {$ruleName}, {$value}");
     try {
         $this->validRule[$ruleName]->assert($value);
     } catch (\Respect\Validation\Exceptions\NestedValidationException $ex) {
         $e = new \InvalidArgumentException($this->validMessage[$ruleName], 0, $ex);
         Cascade::getLogger('bigc\\profile')->warning($e->getMessage());
         throw $e;
     }
     return true;
 }
开发者ID:CrabHo,项目名称:example-lib-profile,代码行数:12,代码来源:ProfileData.php

示例2: testThrowError

 /**
  * @covers Gloubster\Server\GloubsterServer::throwError
  */
 public function testThrowError()
 {
     $server = $this->getServer();
     $exception = new \InvalidArgumentException('SHIT');
     $server['monolog']->expects($this->once())->method('addError')->with($this->equalTo($exception->getMessage()));
     try {
         $server->throwError($exception);
         $this->fail('Should have raised an exception');
     } catch (\Exception $e) {
         $this->assertEquals($exception, $e);
     }
 }
开发者ID:gloubster,项目名称:server,代码行数:15,代码来源:GloubsterServerTest.php

示例3: init

 private function init($fileName)
 {
     if (!file_exists($fileName)) {
         throw InvalidArgumentException::fileNotExists($fileName);
     }
     $this->fileName = $fileName;
 }
开发者ID:arshanam,项目名称:inbound-rocket,代码行数:7,代码来源:ConfigFileReaderTrait.php

示例4: __construct

 public function __construct($fileName)
 {
     if (!file_exists($fileName)) {
         throw InvalidArgumentException::fileNotExists($fileName);
     }
     $this->fileName = $fileName;
 }
开发者ID:shapeways,项目名称:referer-parser,代码行数:7,代码来源:JsonConfigReader.php

示例5: __construct

 public function __construct($name, $value, $expected)
 {
     if (!is_string($name)) {
         throw new InvalidArgumentException("Not a string: name");
     }
     if (!is_string($expected)) {
         throw new InvalidArgumentException("Not a string: expected");
     }
     $lead = "Invalid";
     if (NULL === $value) {
         $lead = "Not set";
     }
     $type = gettype($value);
     $got_msg = $type;
     if (is_object($value)) {
         $class = get_class($value);
         $got_msg = "{$type} ({$class})";
     }
     $this->name = $name;
     $this->type = $type;
     $this->expected = $expected;
     $this->message = $msg;
     $msg = "{$lead}: {$name} - Got: {$got_msg} - Expected: {$expected}";
     parent::__construct($msg, 0);
 }
开发者ID:hovenko,项目名称:Madcow,代码行数:25,代码来源:InvalidArgumentException.php

示例6: __construct

 public function __construct($message, array $errors, Exception $previous = null)
 {
     $flatErrors = iterator_to_array(new RecursiveIteratorIterator(new RecursiveArrayIterator($errors)), false);
     $message = $message . ":\n" . implode("\n", $flatErrors);
     parent::__construct($message, 0, $previous);
     $this->setErrors($errors);
 }
开发者ID:tobiasziegler,项目名称:platform,代码行数:7,代码来源:ValidatorException.php

示例7: __construct

 /**
  * @param string|WeaponlikeCode $message
  * @param int $code
  * @param \Exception $previous
  */
 public function __construct($message = '', $code = 0, \Exception $previous = null)
 {
     if ($message instanceof WeaponlikeCode) {
         $message = "Given weapon-like '{$message}' is of unknown type";
     }
     parent::__construct($message, $code, $previous);
 }
开发者ID:jaroslavtyc,项目名称:drd-plus-person-skills,代码行数:12,代码来源:UnknownTypeOfWeapon.php

示例8: __construct

 /**
  * Constructor.
  *
  * @param mixed        $value
  * @param string|array $expectedType
  */
 public function __construct($value, $expectedType)
 {
     if (is_array($expectedType)) {
         $expectedType = implode('", "', $expectedType);
     }
     parent::__construct(sprintf('Expected argument of type "%s", "%s" given', $expectedType, is_object($value) ? get_class($value) : gettype($value)));
 }
开发者ID:rollerworks,项目名称:search,代码行数:13,代码来源:UnexpectedTypeException.php

示例9: __construct

 public function __construct(\ReflectionParameter $parameter, $message = null, $code = null, \Exception $previous = null)
 {
     if (null === $message) {
         $message = sprintf('Unable to resolve argument $%s (#%d) of %s.', $parameter->name, $parameter->getPosition(), static::getFunctionName($parameter->getDeclaringFunction()));
     }
     parent::__construct($message, $code, $previous);
 }
开发者ID:rybakit,项目名称:arguments-resolver,代码行数:7,代码来源:UnresolvableArgumentException.php

示例10: __construct

 /**
  * @inheritdoc
  */
 public function __construct($message = '', $code = 0, \Exception $previous = null)
 {
     if (empty($message)) {
         $message = 'Invalid argument value.';
     }
     parent::__construct($message, $code, $previous);
 }
开发者ID:krixon,项目名称:exceptions,代码行数:10,代码来源:InvalidArgumentValueException.php

示例11: __construct

 /**
  * @param string $message
  * @param \Exception $previous
  */
 public function __construct($message = null, \Exception $previous = null)
 {
     if (empty($message)) {
         $message = 'Listeners must implements EventListenerInterface';
     }
     parent::__construct($message, $previous);
 }
开发者ID:dw250100785,项目名称:gitlab-webhook,代码行数:11,代码来源:InvalidListenerException.php

示例12: __construct

 /**
  * {@inheritdoc}
  */
 public function __construct($inputCurrency, $allowedCurrencies = null)
 {
     if (null === $allowedCurrencies) {
         $allowedCurrencies = Environment::$ALLOWED_CURRENCIES;
     }
     parent::__construct(sprintf('Invalid currency given (%s), allowed: %s', $inputCurrency, implode(', ', $allowedCurrencies)));
 }
开发者ID:whatwedo,项目名称:postfinance-e-payment,代码行数:10,代码来源:InvalidCurrencyException.php

示例13: __construct

 public function __construct($message = "", $code = 0, Exception $previous = null)
 {
     if (empty($message)) {
         $message = 'The specified file pointer is not a valid stream resource';
     }
     parent::__construct($message, $code, $previous);
 }
开发者ID:akeeba,项目名称:s3,代码行数:7,代码来源:InvalidFilePointer.php

示例14: __construct

 public function __construct($file, $line, $message)
 {
     parent::__construct();
     $this->file = $file;
     $this->line = $line;
     $this->message = $message;
 }
开发者ID:phpml,项目名称:phpml,代码行数:7,代码来源:InvalidArgumentException.php

示例15: __construct

 public function __construct($message = null)
 {
     if ($message === null) {
         $message = 'The parameter must be a non empty string';
     }
     parent::__construct($message);
 }
开发者ID:alpixel,项目名称:AlpixelMenuBundle,代码行数:7,代码来源:LocaleException.php


注:本文中的InvalidArgumentException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。