1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
5
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
6
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
7
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
8
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
9
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
10
|
|
|
* THE SOFTWARE. |
11
|
|
|
* |
12
|
|
|
* This software consists of voluntary contributions made by many individuals |
13
|
|
|
* and is licensed under the MIT license. |
14
|
|
|
* |
15
|
|
|
* Copyright (c) 2015-2017 Yuuki Takezawa |
16
|
|
|
* |
17
|
|
|
*/ |
18
|
|
|
|
19
|
|
|
namespace Ytake\LaravelAspect\PointCut; |
20
|
|
|
|
21
|
|
|
use Illuminate\Contracts\Container\Container; |
22
|
|
|
use Ytake\LaravelAspect\Annotation\MessageDriven; |
23
|
|
|
use Ytake\LaravelAspect\Interceptor\MessageDrivenInterceptor; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Class MessageDrivenPointCut |
27
|
|
|
*/ |
28
|
|
|
class MessageDrivenPointCut extends CommonPointCut implements PointCutable |
29
|
|
|
{ |
30
|
|
|
/** @var string */ |
31
|
|
|
protected $annotation = MessageDriven::class; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @param Container $app |
35
|
|
|
* |
36
|
|
|
* @return \Ray\Aop\Pointcut |
37
|
|
|
*/ |
38
|
|
|
public function configure(Container $app) |
39
|
|
|
{ |
40
|
|
|
$interceptor = new MessageDrivenInterceptor; |
41
|
|
|
$interceptor->setBusDispatcher($app['Illuminate\Contracts\Bus\Dispatcher']); |
42
|
|
|
$this->setInterceptor($interceptor); |
43
|
|
|
|
44
|
|
|
return $this->withAnnotatedAnyInterceptor(); |
45
|
|
|
} |
46
|
|
|
} |
47
|
|
|
|