Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: integrate the notification channel #312

Merged
merged 2 commits into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ This method aims to execute an SQL transaction around a passed arrow function.

```php
Database::transaction(fn() => $user->update(['name' => '']));




```
Ref: #255

Expand Down Expand Up @@ -135,7 +131,7 @@ Release for 5.0.2
## 5.0.0 - 2023-05-10

- [Add] Convert the project from PHP7 to PHP8
- [Add] Multiconnection for storage system
- [Add] Multi connection for storage system
- [Fix] Fixes migrations errors [#176](https://github.com/bowphp/framework/pull/176)
- [Fix] Fixes the column size [#165](https://github.com/bowphp/framework/pull/165)
- [Fix] Add the fallback on old request method [#170](https://github.com/bowphp/framework/pull/170)
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"neitanod/forceutf8": "^2.0",
"ramsey/uuid": "^4.7",
"ext-ftp": "*",
"ext-openssl": "*"
"ext-openssl": "*",
"ext-pcntl": "*"
},
"require-dev": {
"pda/pheanstalk": "^5.0",
Expand Down
4 changes: 3 additions & 1 deletion src/Application/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,9 @@ public function container(?string $name = null, ?callable $callable = null): mix
);
}

return $this->capsule->bind($name, $callable);
$this->capsule->bind($name, $callable);

return $this;
}

/**
Expand Down
1 change: 0 additions & 1 deletion src/Auth/Guards/JwtGuard.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Bow\Auth\Guards;

use Bow\Security\Hash;
use Bow\Support\Log;
use Exception;
use Policier\Policier;
use Bow\Auth\Authentication;
Expand Down
18 changes: 13 additions & 5 deletions src/Auth/Guards/SessionGuard.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
namespace Bow\Auth\Guards;

use Bow\Security\Hash;
use Bow\Session\Exception\SessionException;
use Bow\Session\Session;
use Bow\Auth\Authentication;
use Bow\Auth\Exception\AuthenticationException;
use Bow\Auth\Guards\GuardContract;
use Bow\Auth\Traits\LoginUserTrait;

class SessionGuard extends GuardContract
Expand All @@ -25,7 +25,7 @@ class SessionGuard extends GuardContract
/**
* Defines the session_key
*
* @var array
* @var string
*/
private string $session_key;

Expand All @@ -44,10 +44,11 @@ public function __construct(array $provider, string $guard)
}

/**
* Check if user is authenticate
* Check if user is authenticated
*
* @param array $credentials
* @return bool
* @throws AuthenticationException|SessionException
*/
public function attempts(array $credentials): bool
{
Expand All @@ -72,6 +73,7 @@ public function attempts(array $credentials): bool
* Get the session instance
*
* @return Session
* @throws AuthenticationException
*/
private function getSession(): Session
{
Expand All @@ -87,9 +89,10 @@ private function getSession(): Session
}

/**
* Check if user is authenticate
* Check if user is authenticated
*
* @return bool
* @throws AuthenticationException|SessionException
*/
public function check(): bool
{
Expand All @@ -100,16 +103,18 @@ public function check(): bool
* Check if user is guest
*
* @return bool
* @throws AuthenticationException|SessionException
*/
public function guest(): bool
{
return !$this->check();
}

/**
* Check if user is authenticate
* Check if user is authenticated
*
* @return ?Authentication
* @throws AuthenticationException|SessionException
*/
public function user(): ?Authentication
{
Expand All @@ -121,6 +126,7 @@ public function user(): ?Authentication
*
* @param mixed $user
* @return bool
* @throws AuthenticationException|SessionException
*/
public function login(Authentication $user): bool
{
Expand All @@ -133,6 +139,7 @@ public function login(Authentication $user): bool
* Make direct logout
*
* @return bool
* @throws SessionException|AuthenticationException
*/
public function logout(): bool
{
Expand All @@ -145,6 +152,7 @@ public function logout(): bool
* Get the user id
*
* @return mixed
* @throws AuthenticationException|SessionException
*/
public function id(): mixed
{
Expand Down
1 change: 0 additions & 1 deletion src/Cache/CacheConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use Bow\Configuration\Configuration;
use Bow\Configuration\Loader;
use Bow\Cache\Cache;

class CacheConfiguration extends Configuration
{
Expand Down
5 changes: 2 additions & 3 deletions src/Configuration/LoggerConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
namespace Bow\Configuration;

use Bow\View\View;
use Exception;
use Monolog\Logger;
use Bow\Support\Collection;
use Whoops\Handler\Handler;
use Bow\Configuration\Loader;
use Bow\Database\Barry\Model;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\FirePHPHandler;
use Whoops\Handler\CallbackHandler;
use Bow\Configuration\Configuration;
use Bow\Contracts\ResponseInterface;
use Iterator;
use Whoops\Handler\PrettyPageHandler;
Expand Down Expand Up @@ -99,7 +98,7 @@ function ($exception, $inspector, $run) use ($monolog, $error_handler) {
* @param string $log_dir
* @param string $name
* @return Logger
* @throws \Exception
* @throws Exception
*/
private function loadFileLogger(string $log_dir, string $name): Logger
{
Expand Down
10 changes: 6 additions & 4 deletions src/Console/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ class Command extends AbstractCommand
*/
public function call(string $command, string $action, ...$rest): mixed
{
$class = $this->command[$command] ?? null;
$classes = $this->command[$command] ?? null;

if (is_null($class)) {
if (is_null($classes)) {
$this->throwFailsCommand("The command $command not found !");
}

Expand All @@ -74,8 +74,10 @@ public function call(string $command, string $action, ...$rest): mixed
$method = Str::camel($action);
}

if (is_array($class)) {
$class = $class[$action];
if (is_array($classes)) {
$class = $classes[$action];
} else {
$class = $classes;
}

$instance = new $class($this->setting, $this->arg);
Expand Down
1 change: 0 additions & 1 deletion src/Console/Command/ClearCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class ClearCommand extends AbstractCommand
*
* @param string $action
* @return void
* @throws \ErrorException
*/
public function make(string $action): void
{
Expand Down
1 change: 1 addition & 0 deletions src/Console/Command/GenerateKeyCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class GenerateKeyCommand extends AbstractCommand
* Generate Key
*
* @return void
* @throws ConsoleException
*/
public function generate(): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Console/Command/GenerateResourceControllerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private function createResourceController(
string $prefix,
string $controller,
string $model_namespace = ''
) {
): void {
$generator->write('controller/rest', [
'modelNamespace' => $model_namespace,
'prefix' => $prefix,
Expand Down
2 changes: 2 additions & 0 deletions src/Console/Command/MiddlewareCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class MiddlewareCommand extends AbstractCommand

if ($generator->fileExists()) {
echo Color::red("The middleware already exists");

exit(1);
}

Expand All @@ -34,6 +35,7 @@ class MiddlewareCommand extends AbstractCommand
]);

echo Color::green("The middleware has been well created.");

exit(0);
}
}
19 changes: 10 additions & 9 deletions src/Console/Command/MigrationCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Bow\Database\Migration\SQLGenerator;
use Bow\Database\QueryBuilder;
use Bow\Support\Str;
use Exception;
use JetBrains\PhpStorm\NoReturn;

class MigrationCommand extends AbstractCommand
Expand All @@ -21,7 +22,7 @@ class MigrationCommand extends AbstractCommand
* Make a migration command
*
* @return void
* @throws \Exception
* @throws Exception
*/
public function migrate(): void
{
Expand All @@ -32,7 +33,7 @@ public function migrate(): void
* Rollback migration command
*
* @return void
* @throws \Exception
* @throws Exception
*/
public function rollback(): void
{
Expand All @@ -43,7 +44,7 @@ public function rollback(): void
* Reset migration command
*
* @return void
* @throws \Exception
* @throws Exception
*/
public function reset(): void
{
Expand All @@ -55,7 +56,7 @@ public function reset(): void
*
* @param string $type
* @return void
* @throws \Exception
* @throws Exception
*/
private function factory(string $type): void
{
Expand Down Expand Up @@ -105,7 +106,7 @@ protected function makeUp(array $migrations): void
try {
// Up migration
(new $migration())->up();
} catch (\Exception $exception) {
} catch (Exception $exception) {
$this->throwMigrationException($exception, $migration);
}

Expand Down Expand Up @@ -159,7 +160,7 @@ protected function makeRollback(array $migrations): void
// Rollback migration
try {
(new $migration())->rollback();
} catch (\Exception $exception) {
} catch (Exception $exception) {
$this->throwMigrationException($exception, $migration);
}

Expand Down Expand Up @@ -218,7 +219,7 @@ protected function makeReset(array $migrations): void
// Rollback migration
try {
(new $migration())->rollback();
} catch (\Exception $exception) {
} catch (Exception $exception) {
$this->throwMigrationException($exception, $migration);
}

Expand Down Expand Up @@ -248,10 +249,10 @@ protected function makeReset(array $migrations): void
/**
* Throw migration exception
*
* @param \Exception $exception
* @param Exception $exception
* @param string $migration
*/
#[NoReturn] private function throwMigrationException(\Exception $exception, string $migration): void
#[NoReturn] private function throwMigrationException(Exception $exception, string $migration): void
{
$this->printExceptionMessage(
$exception->getMessage(),
Expand Down
1 change: 0 additions & 1 deletion src/Console/Command/SeederCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ public function all(): void
*
* @param string|null $seeder_name
* @return void
* @throws ErrorException
*/
public function table(?string $seeder_name = null): void
{
Expand Down
3 changes: 2 additions & 1 deletion src/Console/Command/ServiceCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Bow\Console\AbstractCommand;
use Bow\Console\Generator;
use JetBrains\PhpStorm\NoReturn;

class ServiceCommand extends AbstractCommand
{
Expand All @@ -15,7 +16,7 @@ class ServiceCommand extends AbstractCommand
* @param string $service
* @return void
*/
public function generate(string $service): void
#[NoReturn] public function generate(string $service): void
{
$generator = new Generator(
$this->setting->getServiceDirectory(),
Expand Down
3 changes: 2 additions & 1 deletion src/Console/Command/ValidationCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Bow\Console\AbstractCommand;
use Bow\Console\Color;
use Bow\Console\Generator;
use JetBrains\PhpStorm\NoReturn;

class ValidationCommand extends AbstractCommand
{
Expand All @@ -16,7 +17,7 @@ class ValidationCommand extends AbstractCommand
* @param string $validation
* @return void
*/
public function generate(string $validation): void
#[NoReturn] public function generate(string $validation): void
{
$generator = new Generator(
$this->setting->getValidationDirectory(),
Expand Down
2 changes: 1 addition & 1 deletion src/Console/Command/WorkerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class WorkerCommand extends AbstractCommand
/**
* The run server command
*
* @param string $connection
* @param string|null $connection
* @return void
*/
public function run(?string $connection = null): void
Expand Down
Loading
Loading