forked from goaop/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.
Proposal for review of fix for goaop#335
- Loading branch information
Showing
2 changed files
with
55 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
/* | ||
* Go! AOP framework | ||
* | ||
* @copyright Copyright 2016, Lisachenko Alexander <[email protected]> | ||
* | ||
* This source file is subject to the license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Go\Aop\Pointcut; | ||
|
||
use Go\Aop\Pointcut; | ||
use Go\Aop\PointFilter; | ||
|
||
/** | ||
* Pointcut that filters out all class method and properties which are not declared within class | ||
*/ | ||
class ClassDeclaresPointcut implements Pointcut | ||
{ | ||
use PointcutClassFilterTrait; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function matches($point, $context = null, $instance = null, array $arguments = null) | ||
{ | ||
if (!$context instanceof \ReflectionClass) { | ||
return false; | ||
}; | ||
|
||
if (!($point instanceof \ReflectionMethod) && !($point instanceof \ReflectionProperty)) { | ||
return false; | ||
} | ||
|
||
return $point->getDeclaringClass()->getName() === $context->getName(); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getKind() | ||
{ | ||
return PointFilter::KIND_METHOD | PointFilter::KIND_PROPERTY; | ||
} | ||
} |
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