-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
1,571 additions
and
0 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,20 @@ | ||
# https://EditorConfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 4 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
block_comment_start = /* | ||
block_comment = * | ||
block_comment_end = */ | ||
|
||
[*.yml] | ||
indent_size = 2 | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
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,10 @@ | ||
.editorconfig export-ignore | ||
.gitattributes export-ignore | ||
.github/ export-ignore | ||
.gitignore export-ignore | ||
CHANGELOG.md export-ignore | ||
ecs.php export-ignore | ||
phpstan.neon export-ignore | ||
phpunit.xml.dist export-ignore | ||
docs/ export-ignore | ||
tests/ export-ignore |
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,130 @@ | ||
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow | ||
|
||
name: "Integrate" | ||
|
||
on: | ||
push: | ||
branches: | ||
- "develop" | ||
pull_request: null | ||
|
||
env: | ||
PHP_EXTENSIONS: "intl" | ||
|
||
jobs: | ||
file_consistency: | ||
name: "1️⃣ File consistency" | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: "Set up PHP" | ||
uses: "shivammathur/setup-php@v2" | ||
with: | ||
php-version: "8.1" | ||
extensions: "${{ env.PHP_EXTENSIONS }}" | ||
ini-values: "post_max_size=256M" | ||
|
||
- name: "Checkout code" | ||
uses: "actions/checkout@v4" | ||
|
||
- name: Install Effigy | ||
run: | | ||
composer global config --no-plugins allow-plugins.phpstan/extension-installer true | ||
composer global require decodelabs/effigy | ||
- name: "Install dependencies" | ||
uses: "ramsey/composer-install@v3" | ||
with: | ||
dependency-versions: "highest" | ||
|
||
- name: "Check file permissions" | ||
run: | | ||
composer global exec effigy check-executable-permissions | ||
- name: "Check exported files" | ||
run: | | ||
composer global exec effigy check-git-exports | ||
- name: "Find non-printable ASCII characters" | ||
run: | | ||
composer global exec effigy check-non-ascii | ||
- name: "Check source code for syntax errors" | ||
run: | | ||
composer global exec effigy lint | ||
static_analysis: | ||
name: "3️⃣ Static Analysis" | ||
needs: | ||
- "file_consistency" | ||
runs-on: "ubuntu-latest" | ||
strategy: | ||
matrix: | ||
php-version: | ||
- "8.1" | ||
- "8.2" | ||
- "8.3" | ||
steps: | ||
- name: "Set up PHP" | ||
uses: "shivammathur/setup-php@v2" | ||
with: | ||
php-version: "${{ matrix.php-version }}" | ||
extensions: "${{ env.PHP_EXTENSIONS }}" | ||
ini-values: "post_max_size=256M" | ||
|
||
- name: "Checkout code" | ||
uses: "actions/checkout@v4" | ||
|
||
- name: Install Effigy | ||
run: | | ||
composer global config --no-plugins allow-plugins.phpstan/extension-installer true | ||
composer global require decodelabs/effigy | ||
- name: "Validate Composer configuration" | ||
run: "composer validate --strict" | ||
|
||
- name: "Install dependencies" | ||
uses: "ramsey/composer-install@v3" | ||
with: | ||
dependency-versions: "highest" | ||
|
||
- name: "Execute static analysis" | ||
run: | | ||
composer global exec effigy analyze -- --headless | ||
coding_standards: | ||
name: "4️⃣ Coding Standards" | ||
needs: | ||
- "file_consistency" | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: "Set up PHP" | ||
uses: "shivammathur/setup-php@v2" | ||
with: | ||
php-version: "8.1" | ||
extensions: "${{ env.PHP_EXTENSIONS }}" | ||
ini-values: "post_max_size=256M" | ||
|
||
- name: "Checkout code" | ||
uses: "actions/checkout@v4" | ||
|
||
- name: "Check EditorConfig configuration" | ||
run: "test -f .editorconfig" | ||
|
||
- name: "Check adherence to EditorConfig" | ||
uses: "greut/eclint-action@v0" | ||
|
||
- name: Install Effigy | ||
run: | | ||
composer global config --no-plugins allow-plugins.phpstan/extension-installer true | ||
composer global require decodelabs/effigy | ||
- name: "Install dependencies" | ||
uses: "ramsey/composer-install@v3" | ||
with: | ||
dependency-versions: "highest" | ||
|
||
- name: "Check coding style" | ||
run: | | ||
composer global exec effigy format -- --headless | ||
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,8 @@ | ||
/vendor | ||
composer.phar | ||
composer.lock | ||
.DS_Store | ||
Thumbs.db | ||
/phpunit.xml | ||
/.idea | ||
/.env |
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,3 @@ | ||
## v0.1.0 (2024-06-19) | ||
* Built initial Verifier implementation | ||
* Built basic Renderer system |
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,32 @@ | ||
# Scrutiny | ||
|
||
[![PHP from Packagist](https://img.shields.io/packagist/php-v/decodelabs/scrutiny?style=flat)](https://packagist.org/packages/decodelabs/scrutiny) | ||
[![Latest Version](https://img.shields.io/packagist/v/decodelabs/scrutiny.svg?style=flat)](https://packagist.org/packages/decodelabs/scrutiny) | ||
[![Total Downloads](https://img.shields.io/packagist/dt/decodelabs/scrutiny.svg?style=flat)](https://packagist.org/packages/decodelabs/scrutiny) | ||
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/decodelabs/scrutiny/integrate.yml?branch=develop)](https://github.com/decodelabs/scrutiny/actions/workflows/integrate.yml) | ||
[![PHPStan](https://img.shields.io/badge/PHPStan-enabled-44CC11.svg?longCache=true&style=flat)](https://github.com/phpstan/phpstan) | ||
[![License](https://img.shields.io/packagist/l/decodelabs/scrutiny?style=flat)](https://packagist.org/packages/decodelabs/scrutiny) | ||
|
||
### Unified human check controls | ||
|
||
Scrutiny provides a simple, standardised interface for checking your users are human. It supports a range of different verification methods and can be easily extended to support more. | ||
|
||
_Get news and updates on the [DecodeLabs blog](https://blog.decodelabs.com)._ | ||
|
||
--- | ||
|
||
## Installation | ||
|
||
Install via Composer: | ||
|
||
```bash | ||
composer require decodelabs/scrutiny | ||
``` | ||
|
||
## Usage | ||
|
||
Coming soon... | ||
|
||
## Licensing | ||
|
||
Scrutiny is licensed under the MIT License. See [LICENSE](./LICENSE) for the full license text. |
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,47 @@ | ||
{ | ||
"name": "decodelabs/scrutiny", | ||
"description": "Unified human check controls", | ||
"type": "library", | ||
"keywords": [ ], | ||
"license": "MIT", | ||
"authors": [ { | ||
"name": "Tom Wright", | ||
"email": "[email protected]" | ||
} ], | ||
"require": { | ||
"php": "^8.1", | ||
|
||
"decodelabs/archetype": "^0.3.5", | ||
"decodelabs/coercion": "^0.2.8", | ||
"decodelabs/compass": "^0.1.7", | ||
"decodelabs/dictum": "^0.6.2", | ||
"decodelabs/exceptional": "^0.4.5", | ||
"decodelabs/glitch-support": "^0.4.6", | ||
"decodelabs/hydro": "^0.1.3", | ||
"decodelabs/slingshot": "^0.1.9", | ||
"decodelabs/tagged": "^0.15.0", | ||
"decodelabs/veneer": "^0.10.25", | ||
|
||
"symfony/polyfill-php82": "^1.29" | ||
}, | ||
"require-dev": { | ||
"decodelabs/phpstan-decodelabs": "^0.6.8", | ||
"decodelabs/dovetail": "^0.2.5" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"DecodeLabs\\Scrutiny\\": "src/Scrutiny" | ||
}, | ||
"classmap": [ | ||
"src/Dovetail/" | ||
], | ||
"files": [ | ||
"src/Scrutiny/Context.php" | ||
] | ||
}, | ||
"extra": { | ||
"branch-alias": { | ||
"dev-develop": "0.1.x-dev" | ||
} | ||
} | ||
} |
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,14 @@ | ||
<?php | ||
|
||
// ecs.php | ||
|
||
declare(strict_types=1); | ||
|
||
use Symplify\EasyCodingStandard\Config\ECSConfig; | ||
|
||
return ECSConfig::configure() | ||
->withPaths([__DIR__.'/src']) | ||
->withPreparedSets( | ||
cleanCode: true, | ||
psr12: true | ||
); |
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,4 @@ | ||
parameters: | ||
paths: | ||
- src | ||
level: max |
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,52 @@ | ||
<?php | ||
|
||
/** | ||
* @package Scrutiny | ||
* @license http://opensource.org/licenses/MIT | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace DecodeLabs\Dovetail\Config; | ||
|
||
use DecodeLabs\Dovetail\Config; | ||
use DecodeLabs\Dovetail\ConfigTrait; | ||
use DecodeLabs\Scrutiny\Config as ConfigInterface; | ||
|
||
class Scrutiny implements Config, ConfigInterface | ||
{ | ||
use ConfigTrait; | ||
|
||
public static function getDefaultValues(): array | ||
{ | ||
return [ | ||
'VerifierName' => [ | ||
'enabled' => false, | ||
'siteKey' => '--siteKey--', | ||
'secret' => "{{envString('VERIFIER_SECRET')}}", | ||
] | ||
]; | ||
} | ||
|
||
public function getFirstEnabledVerifier(): ?string | ||
{ | ||
foreach ($this->data as $name => $settings) { | ||
if ($settings->enabled->as('bool', [ | ||
'default' => true | ||
])) { | ||
return (string)$name; | ||
} | ||
} | ||
|
||
return null; | ||
} | ||
|
||
/** | ||
* @return array<string, mixed> | ||
*/ | ||
public function getSettingsFor( | ||
string $verifierName | ||
): array { | ||
return $this->data->{$verifierName}->toArray(); | ||
} | ||
} |
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,22 @@ | ||
<?php | ||
|
||
/** | ||
* @package Scrutiny | ||
* @license http://opensource.org/licenses/MIT | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace DecodeLabs\Scrutiny; | ||
|
||
interface Config | ||
{ | ||
public function getFirstEnabledVerifier(): ?string; | ||
|
||
/** | ||
* @return array<string, mixed> | ||
*/ | ||
public function getSettingsFor( | ||
string $verifierName | ||
): array; | ||
} |
Oops, something went wrong.