forked from laravel/framework
-
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
1 parent
7e90855
commit 1ae6e9f
Showing
10 changed files
with
132 additions
and
12 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
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
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
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,25 @@ | ||
<?php | ||
|
||
namespace LaravelZero\Framework\Contracts\Providers; | ||
|
||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
/** | ||
* This is the Zero Framework ErrorHandler Contract. | ||
* | ||
* @author Nuno Maduro <[email protected]> | ||
*/ | ||
interface ErrorHandler | ||
{ | ||
/** | ||
* Registers the error handler. | ||
*/ | ||
public function register(): void; | ||
|
||
/** | ||
* Sets the output of the error handler. | ||
* | ||
* @param \Symfony\Component\Console\Output\OutputInterface $output | ||
*/ | ||
public function setOutput(OutputInterface $output): void; | ||
} |
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,48 @@ | ||
<?php | ||
|
||
namespace LaravelZero\Framework\Providers\ErrorHandler; | ||
|
||
use NunoMaduro\Collision\Provider; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use NunoMaduro\Collision\Contracts\Provider as ProviderContract; | ||
use LaravelZero\Framework\Contracts\Providers\ErrorHandler as ErrorHandlerContract; | ||
|
||
/** | ||
* This is the Zero Framework Error Handler class. | ||
* | ||
* @author Nuno Maduro <[email protected]> | ||
*/ | ||
class ErrorHandler implements ErrorHandlerContract | ||
{ | ||
/** | ||
* @var \NunoMaduro\Collision\Contracts\Provider | ||
*/ | ||
protected $provider; | ||
|
||
/** | ||
* Creates a new instance of the class. | ||
* | ||
* @param \NunoMaduro\Collision\Contracts\Provider|null $provider | ||
*/ | ||
public function __construct(ProviderContract $provider = null) | ||
{ | ||
$this->provider = $provider ?: new Provider; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function register(): void | ||
{ | ||
$this->provider->register(); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function setOutput(OutputInterface $output): void | ||
{ | ||
$this->provider->getHandler() | ||
->setOutput($output); | ||
} | ||
} |
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 @@ | ||
<?php | ||
|
||
namespace LaravelZero\Framework\Providers\ErrorHandler; | ||
|
||
use Illuminate\Support\ServiceProvider as BaseServiceProvider; | ||
use LaravelZero\Framework\Contracts\Providers\ErrorHandler as ErrorHandlerContract; | ||
|
||
/** | ||
* This is the Zero Framework composer service provider class. | ||
* | ||
* @author Nuno Maduro <[email protected]> | ||
*/ | ||
class ServiceProvider extends BaseServiceProvider | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public function boot(ErrorHandlerContract $errorHandler): void | ||
{ | ||
$errorHandler->register(); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function register(): void | ||
{ | ||
$this->app->singleton(ErrorHandlerContract::class, function() { | ||
return new ErrorHandler; | ||
}); | ||
} | ||
} |
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,6 @@ | ||
<?php | ||
|
||
namespace Tests\Unit; | ||
namespace Tests\Integration; | ||
|
||
use Tests\TestCase; | ||
use Tests\FakeExtraCommand; | ||
|
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