-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #391 from nextcloud/webauthn
Webauthn
- Loading branch information
Showing
378 changed files
with
41,905 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Copyright (c) 2011-2013, Benjamin Eberlei | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
- Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
- Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{ | ||
"name": "beberlei/assert", | ||
"description": "Thin assertion library for input validation in business models.", | ||
"authors": [ | ||
{ | ||
"name": "Benjamin Eberlei", | ||
"email": "kontakt@beberlei.de", | ||
"role": "Lead Developer" | ||
}, | ||
{ | ||
"name": "Richard Quadling", | ||
"email": "rquadling@gmail.com", | ||
"role": "Collaborator" | ||
} | ||
], | ||
"license": "BSD-2-Clause", | ||
"keywords": [ | ||
"assert", | ||
"assertion", | ||
"validation" | ||
], | ||
"autoload": { | ||
"psr-4": { | ||
"Assert\\": "lib/Assert" | ||
}, | ||
"files": [ | ||
"lib/Assert/functions.php" | ||
] | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Assert\\Tests\\": "tests/Assert/Tests" | ||
}, | ||
"files": [ | ||
"tests/Assert/Tests/Fixtures/functions.php" | ||
] | ||
}, | ||
"config": { | ||
"sort-packages": true | ||
}, | ||
"require": { | ||
"php": "^7", | ||
"ext-simplexml": "*", | ||
"ext-mbstring": "*", | ||
"ext-ctype": "*", | ||
"ext-json": "*" | ||
}, | ||
"require-dev": { | ||
"friendsofphp/php-cs-fixer": "*", | ||
"phpstan/phpstan-shim": "*", | ||
"phpunit/phpunit": ">=6.0.0 <8" | ||
}, | ||
"scripts": { | ||
"assert:generate-docs": "php bin/generate_method_docs.php", | ||
"assert:cs-lint": "php-cs-fixer fix --diff -vvv --dry-run", | ||
"assert:cs-fix": "php-cs-fixer fix . -vvv || true", | ||
"assert:sa-code": "vendor/bin/phpstan analyse --configuration=phpstan-code.neon --no-progress --ansi -l 7 bin lib", | ||
"assert:sa-tests": "vendor/bin/phpstan analyse --configuration=phpstan-tests.neon --no-progress --ansi -l 7 tests" | ||
}, | ||
"suggest": { | ||
"ext-intl": "Needed to allow Assertion::count(), Assertion::isCountable(), Assertion::minCount(), and Assertion::maxCount() to operate on ResourceBundles" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<?php | ||
|
||
/** | ||
* Assert | ||
* | ||
* LICENSE | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this package in the file LICENSE.txt. | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to kontakt@beberlei.de so I can send you a copy immediately. | ||
*/ | ||
|
||
namespace Assert; | ||
|
||
/** | ||
* AssertionChain factory. | ||
*/ | ||
abstract class Assert | ||
{ | ||
/** @var string */ | ||
protected static $lazyAssertionExceptionClass = LazyAssertionException::class; | ||
|
||
/** @var string */ | ||
protected static $assertionClass = Assertion::class; | ||
|
||
/** | ||
* Start validation on a value, returns {@link AssertionChain}. | ||
* | ||
* The invocation of this method starts an assertion chain | ||
* that is happening on the passed value. | ||
* | ||
* @param mixed $value | ||
* @param string|callable|null $defaultMessage | ||
* @param string|null $defaultPropertyPath | ||
* | ||
* @return AssertionChain | ||
* | ||
* @example | ||
* | ||
* Assert::that($value)->notEmpty()->integer(); | ||
* Assert::that($value)->nullOr()->string()->startsWith("Foo"); | ||
* | ||
* The assertion chain can be stateful, that means be careful when you reuse | ||
* it. You should never pass around the chain. | ||
*/ | ||
public static function that($value, $defaultMessage = null, string $defaultPropertyPath = null): AssertionChain | ||
{ | ||
$assertionChain = new AssertionChain($value, $defaultMessage, $defaultPropertyPath); | ||
|
||
return $assertionChain->setAssertionClassName(static::$assertionClass); | ||
} | ||
|
||
/** | ||
* Start validation on a set of values, returns {@link AssertionChain}. | ||
* | ||
* @param mixed $values | ||
* @param string|callable|null $defaultMessage | ||
* @param string|null $defaultPropertyPath | ||
* | ||
* @return AssertionChain | ||
*/ | ||
public static function thatAll($values, $defaultMessage = null, string $defaultPropertyPath = null): AssertionChain | ||
{ | ||
return static::that($values, $defaultMessage, $defaultPropertyPath)->all(); | ||
} | ||
|
||
/** | ||
* Start validation and allow NULL, returns {@link AssertionChain}. | ||
* | ||
* @param mixed $value | ||
* @param string|callable|null $defaultMessage | ||
* @param string|null $defaultPropertyPath | ||
* | ||
* @return AssertionChain | ||
*/ | ||
public static function thatNullOr($value, $defaultMessage = null, string $defaultPropertyPath = null): AssertionChain | ||
{ | ||
return static::that($value, $defaultMessage, $defaultPropertyPath)->nullOr(); | ||
} | ||
|
||
/** | ||
* Create a lazy assertion object. | ||
* | ||
* @return LazyAssertion | ||
*/ | ||
public static function lazy(): LazyAssertion | ||
{ | ||
$lazyAssertion = new LazyAssertion(); | ||
|
||
return $lazyAssertion | ||
->setAssertClass(\get_called_class()) | ||
->setExceptionClass(static::$lazyAssertionExceptionClass); | ||
} | ||
} |
Oops, something went wrong.