Last active
August 10, 2019 08:47
-
-
Save inhere/4cfa0a17cdd09b74c212461be420717f to your computer and use it in GitHub Desktop.
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
<?php declare(strict_types=1); | |
namespace App\Model\Logic; | |
use Exception; | |
use Swoft\Bean\Annotation\Mapping\Bean; | |
use Swoft\Breaker\Annotation\Mapping\Breaker; | |
/** | |
* Class BreakerLogic | |
* | |
* @since 2.0 | |
* | |
* @Bean() | |
*/ | |
class BreakerLogic | |
{ | |
/** | |
* @Breaker(fallback="loopFallback") | |
* | |
* @return string | |
* @throws Exception | |
*/ | |
public function loop(): string | |
{ | |
// Do something | |
throw new Exception('Breaker exception'); | |
} | |
/** | |
* @return string | |
* @throws Exception | |
*/ | |
public function loopFallback(): string | |
{ | |
// Do something | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment