-
Notifications
You must be signed in to change notification settings - Fork 1
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 #8 from lloc/add-di
PHP DI integrated
- Loading branch information
Showing
62 changed files
with
525 additions
and
960 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,30 @@ | ||
/.wordpress-org | ||
/.git | ||
/.github | ||
/.idea | ||
/.phpunit.cache | ||
/bin | ||
/wp-nowpayments-integration | ||
/node_modules | ||
/reports | ||
/src | ||
/tests | ||
.distignore | ||
.gitattributes | ||
.gitignore | ||
.scrutinizer.yml | ||
Changelog.md | ||
Diagrams.md | ||
README.md | ||
composer.json | ||
composer.lock | ||
package-lock.json | ||
package.json | ||
patchwork.json | ||
phpcs.xml | ||
phpdoc.xml | ||
phpstan.neon | ||
phpunit.xml | ||
playwright.config.ts | ||
setup.sh | ||
multisite-language-switcher.zip |
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 @@ | ||
name: Plugin Check | ||
on: # rebuild any PRs and main branch changes | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Composer dependencies | ||
run: composer install --no-dev --no-interaction --optimize-autoloader | ||
- name: Build | ||
run: composer run-script build | ||
- name: Run plugin check | ||
uses: wordpress/plugin-check-action@v1 | ||
with: | ||
build-dir: './wp-nowpayments-integration' |
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 |
---|---|---|
@@ -1,6 +1,9 @@ | ||
{ | ||
"core": "WordPress/WordPress", | ||
"plugins": [ | ||
"." | ||
] | ||
} | ||
"core": "WordPress/WordPress", | ||
"plugins": [ | ||
"." | ||
], | ||
"config": { | ||
"WP_ENVIRONMENT_TYPE": "development" | ||
} | ||
} |
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,12 @@ | ||
#!/usr/bin/env bash | ||
|
||
PROJECT_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" | ||
PLUGIN_NAME="wp-nowpayments-integration" | ||
BUILD_PATH="$PROJECT_ROOT/$PLUGIN_NAME" | ||
ZIP_ARCHIVE="$PROJECT_ROOT/$PLUGIN_NAME.zip" | ||
|
||
rm -f $ZIP_ARCHIVE | ||
rm -rf $BUILD_PATH && mkdir $BUILD_PATH | ||
|
||
rsync -arvp --exclude-from=$PROJECT_ROOT/.distignore $PROJECT_ROOT/ $BUILD_PATH/ | ||
cd $PROJECT_ROOT && zip -r $ZIP_ARCHIVE $PLUGIN_NAME |
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
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,39 @@ | ||
<?php declare( strict_types=1 ); | ||
|
||
use lloc\Nowpayments\AdminWidget; | ||
use lloc\Nowpayments\Logs\StructuredLogsFormatter; | ||
use lloc\Nowpayments\Rest\Api; | ||
|
||
use Monolog\Handler\StreamHandler; | ||
use Monolog\Logger; | ||
|
||
use Psr\Log\LogLevel; | ||
use Psr\Log\LoggerInterface; | ||
use Psr\Container\ContainerInterface; | ||
|
||
use function DI\create; | ||
use function DI\get; | ||
use function DI\factory; | ||
|
||
if ( ! defined( 'ABSPATH' ) ) { | ||
exit; | ||
} | ||
|
||
return array( | ||
'formatter' => create( StructuredLogsFormatter::class ), | ||
'debug_handler' => create( StreamHandler::class ) | ||
->constructor( 'php://stdout', LogLevel::DEBUG ) | ||
->method( 'setFormatter', get( 'formatter' ) ), | ||
'error_handler' => create( StreamHandler::class ) | ||
->constructor( 'php://stderr', LogLevel::ERROR ) | ||
->method( 'setFormatter', get( 'formatter' ) ), | ||
LoggerInterface::class => function ( ContainerInterface $c ) { | ||
$logger = new Logger( 'wp-nowpayments-integration-logs' ); | ||
$logger->pushHandler( $c->get( 'debug_handler' ) ); | ||
$logger->pushHandler( $c->get( 'error_handler' ) ); | ||
|
||
return $logger; | ||
}, | ||
Api::class => factory( array( Api::class, 'create' ) ), | ||
AdminWidget::class => factory( array( AdminWidget::class, 'create' ) ), | ||
); |
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
This file was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<?php | ||
<?php declare( strict_types=1 ); | ||
|
||
namespace lloc\Nowpayments\Integration; | ||
|
||
|
Oops, something went wrong.