Skip to content

Commit

Permalink
💄
Browse files Browse the repository at this point in the history
  • Loading branch information
codemasher committed Jul 8, 2023
1 parent 60fb258 commit 9560e55
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 19 deletions.
10 changes: 5 additions & 5 deletions .phan/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
// Note that the **only** effect of choosing `'5.6'` is to infer
// that functions removed in php 7.0 exist.
// (See `backward_compatibility_checks` for additional options)
'target_php_version' => null,
'minimum_target_php_version' => '8.2',
'target_php_version' => null,
'minimum_target_php_version' => '8.2',

// A list of directories that should be parsed for class and
// method information. After excluding the directories
Expand All @@ -24,7 +24,7 @@
//
// Thus, both first-party and third-party code being used by
// your application should be included in this list.
'directory_list' => [
'directory_list' => [
'examples',
'src',
'tests',
Expand All @@ -35,7 +35,7 @@
// exclude from parsing. Actual value will exclude every
// "test", "tests", "Test" and "Tests" folders found in
// "vendor/" directory.
'exclude_file_regex' => '@^vendor/.*/(tests?|Tests?)/@',
'exclude_file_regex' => '@^vendor/.*/(tests?|Tests?)/@',

// A directory list that defines files that will be excluded
// from static analysis, but whose class and method
Expand All @@ -51,7 +51,7 @@
'exclude_analysis_directory_list' => [
'vendor/',
],
'suppress_issue_types' => [
'suppress_issue_types' => [
'PhanAccessMethodInternal',
],
];
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,19 @@ A generator for counter based ([RFC 4226](https://tools.ietf.org/html/rfc4226))

[![PHP Version Support][php-badge]][php]
[![version][packagist-badge]][packagist]
[![Downloads][downloads-badge]][downloads]
[![License][license-badge]][license]
[![GitHub actions workflow][gh-action-badge]][gh-action]
[![Coverage][coverage-badge]][coverage]
[![Codacy][codacy-badge]][codacy]
[![Downloads][downloads-badge]][downloads]

[php-badge]: https://img.shields.io/packagist/php-v/chillerlan/php-authenticator?logo=php&color=8892BF
[php]: https://www.php.net/supported-versions.php
[packagist-badge]: https://img.shields.io/packagist/v/chillerlan/php-authenticator.svg?logo=packagist
[packagist]: https://packagist.org/packages/chillerlan/php-authenticator
[downloads-badge]: https://img.shields.io/packagist/dt/chillerlan/php-authenticator.svg?logo=packagist
[downloads]: https://packagist.org/packages/chillerlan/php-authenticator/stats

[license-badge]: https://img.shields.io/github/license/chillerlan/php-authenticator.svg
[license]: https://github.com/chillerlan/php-authenticator/blob/main/LICENSE
[gh-action-badge]: https://img.shields.io/github/actions/workflow/status/chillerlan/php-authenticator/ci.yml?branch=main&logo=github
Expand All @@ -22,8 +25,6 @@ A generator for counter based ([RFC 4226](https://tools.ietf.org/html/rfc4226))
[coverage]: https://app.codecov.io/github/chillerlan/php-authenticator/tree/main
[codacy-badge]: https://img.shields.io/codacy/grade/a2793225b448495c9659f27f7f52380a/main?logo=codacy
[codacy]: https://www.codacy.com/gh/chillerlan/php-authenticator/dashboard?branch=main
[downloads-badge]: https://img.shields.io/packagist/dt/chillerlan/php-authenticator.svg?logo=packagist
[downloads]: https://packagist.org/packages/chillerlan/php-authenticator/stats

# Documentation
## Requirements
Expand Down
10 changes: 5 additions & 5 deletions examples/battlenet.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
* @license MIT
*/

use chillerlan\Authenticator\{Authenticator, AuthenticatorOptions, Authenticators\BattleNet};
use chillerlan\Authenticator\Authenticators\AuthenticatorInterface;
use chillerlan\Authenticator\{Authenticator, AuthenticatorOptions};
use chillerlan\Authenticator\Authenticators\{AuthenticatorInterface, BattleNet};

require_once '../vendor/autoload.php';

Expand All @@ -28,12 +28,12 @@
// verify the current code
var_dump($auth->verify($code)); // -> true
// previous code
var_dump($auth->verify($code, time() - $options->period)); // -> true
var_dump($auth->verify($code, (time() - $options->period))); // -> true
// 2nd adjacent is invalid
var_dump($auth->verify($code, time() + 2 * $options->period)); // -> false
var_dump($auth->verify($code, (time() + 2 * $options->period))); // -> false
// allow 2 adjacent codes
$options->adjacent = 2;
var_dump($auth->verify($code, time() + 2 * $options->period)); // -> true
var_dump($auth->verify($code, (time() + 2 * $options->period))); // -> true

// request a new authenticator from the Battle.net API
// this requires the BattleNet class to be invoked directly as we're using non-interface methods for this
Expand Down
6 changes: 3 additions & 3 deletions examples/steam.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
// verify the current code
var_dump($auth->verify($code)); // -> true
// previous code
var_dump($auth->verify($code, time() - $options->period)); // -> true
var_dump($auth->verify($code, (time() - $options->period))); // -> true
// 2nd adjacent is invalid
var_dump($auth->verify($code, time() + 2 * $options->period)); // -> false
var_dump($auth->verify($code, (time() + 2 * $options->period))); // -> false
// allow 2 adjacent codes
$options->adjacent = 2;
var_dump($auth->verify($code, time() + 2 * $options->period)); // -> true
var_dump($auth->verify($code, (time() + 2 * $options->period))); // -> true
6 changes: 3 additions & 3 deletions examples/totp.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@
// verify the code
var_dump($auth->verify($code)); // -> true
// verify against the previous time slice
var_dump($auth->verify($code, time() - $options->period)); // -> true
var_dump($auth->verify($code, (time() - $options->period))); // -> true
// 2 steps ahead (1 is default)
var_dump($auth->verify($code, time() + 2 * $options->period)); // -> false
var_dump($auth->verify($code, (time() + 2 * $options->period))); // -> false
// set adjacent codes to 2 and try again
$options->adjacent = 2;
var_dump($auth->verify($code, time() + 2 * $options->period)); // -> true
var_dump($auth->verify($code, (time() + 2 * $options->period))); // -> true

// create an URI for use in e.g. QR codes
// -> otpauth://totp/test?secret=JQUZJ44H6M3SATXIJRKTK64VQMIU73JN&issuer=example.com&digits=8&algorithm=SHA512&period=60
Expand Down
1 change: 1 addition & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@

<rule ref="Squiz">
<exclude name="Squiz.Arrays.ArrayDeclaration.IndexNoNewline" />
<exclude name="Squiz.Arrays.ArrayDeclaration.MultiLineNotAllowed" />
<exclude name="Squiz.Arrays.ArrayDeclaration.SingleLineNotAllowed" />
<exclude name="Squiz.Arrays.ArrayDeclaration.ValueNoNewline" />
<exclude name="Squiz.Classes.ClassDeclaration" />
Expand Down

0 comments on commit 9560e55

Please sign in to comment.