Skip to content

Instantly share code, notes, and snippets.

@inhere
Last active August 10, 2019 08:47
Show Gist options
  • Save inhere/4cfa0a17cdd09b74c212461be420717f to your computer and use it in GitHub Desktop.
Save inhere/4cfa0a17cdd09b74c212461be420717f to your computer and use it in GitHub Desktop.
<?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