-
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.
Basic pointcut matching of method, class, within
- Loading branch information
1 parent
1a502bf
commit f835108
Showing
16 changed files
with
898 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
src/Kdyby/Aop/Pointcut/Matcher/ClassAnnotateWithMatcher.php
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,29 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the Kdyby (http://www.kdyby.org) | ||
* | ||
* Copyright (c) 2008 Filip Procházka ([email protected]) | ||
* | ||
* For the full copyright and license information, please view the file license.txt that was distributed with this source code. | ||
*/ | ||
|
||
namespace Kdyby\Aop\Pointcut\Matcher; | ||
|
||
use Kdyby; | ||
use Nette; | ||
|
||
|
||
|
||
/** | ||
* @author Filip Procházka <[email protected]> | ||
*/ | ||
class ClassAnnotateWithMatcher extends Nette\Object implements Kdyby\Aop\Pointcut\Rule | ||
{ | ||
|
||
public function matches(Kdyby\Aop\Pointcut\Method $method) | ||
{ | ||
|
||
} | ||
|
||
} |
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,43 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the Kdyby (http://www.kdyby.org) | ||
* | ||
* Copyright (c) 2008 Filip Procházka ([email protected]) | ||
* | ||
* For the full copyright and license information, please view the file license.txt that was distributed with this source code. | ||
*/ | ||
|
||
namespace Kdyby\Aop\Pointcut\Matcher; | ||
|
||
use Kdyby; | ||
use Nette; | ||
|
||
|
||
|
||
/** | ||
* @author Filip Procházka <[email protected]> | ||
*/ | ||
class ClassMatcher extends Nette\Object implements Kdyby\Aop\Pointcut\Rule | ||
{ | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $class; | ||
|
||
|
||
|
||
public function __construct($class) | ||
{ | ||
$this->class = str_replace('\\*', '.*', preg_quote($class)); | ||
} | ||
|
||
|
||
|
||
public function matches(Kdyby\Aop\Pointcut\Method $method) | ||
{ | ||
return preg_match('~^' . $this->class . '\z~i', $method->getClassName()); | ||
} | ||
|
||
} |
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,29 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the Kdyby (http://www.kdyby.org) | ||
* | ||
* Copyright (c) 2008 Filip Procházka ([email protected]) | ||
* | ||
* For the full copyright and license information, please view the file license.txt that was distributed with this source code. | ||
*/ | ||
|
||
namespace Kdyby\Aop\Pointcut\Matcher; | ||
|
||
use Kdyby; | ||
use Nette; | ||
|
||
|
||
|
||
/** | ||
* @author Filip Procházka <[email protected]> | ||
*/ | ||
class EvaluateMatcher extends Nette\Object implements Kdyby\Aop\Pointcut\Rule | ||
{ | ||
|
||
public function matches(Kdyby\Aop\Pointcut\Method $method) | ||
{ | ||
|
||
} | ||
|
||
} |
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,29 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the Kdyby (http://www.kdyby.org) | ||
* | ||
* Copyright (c) 2008 Filip Procházka ([email protected]) | ||
* | ||
* For the full copyright and license information, please view the file license.txt that was distributed with this source code. | ||
*/ | ||
|
||
namespace Kdyby\Aop\Pointcut\Matcher; | ||
|
||
use Kdyby; | ||
use Nette; | ||
|
||
|
||
|
||
/** | ||
* @author Filip Procházka <[email protected]> | ||
*/ | ||
class FilterMatcher extends Nette\Object implements Kdyby\Aop\Pointcut\Rule | ||
{ | ||
|
||
public function matches(Kdyby\Aop\Pointcut\Method $method) | ||
{ | ||
|
||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
src/Kdyby/Aop/Pointcut/Matcher/MethodAnnotateWithMatcher.php
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,29 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the Kdyby (http://www.kdyby.org) | ||
* | ||
* Copyright (c) 2008 Filip Procházka ([email protected]) | ||
* | ||
* For the full copyright and license information, please view the file license.txt that was distributed with this source code. | ||
*/ | ||
|
||
namespace Kdyby\Aop\Pointcut\Matcher; | ||
|
||
use Kdyby; | ||
use Nette; | ||
|
||
|
||
|
||
/** | ||
* @author Filip Procházka <[email protected]> | ||
*/ | ||
class MethodAnnotateWithMatcher extends Nette\Object implements Kdyby\Aop\Pointcut\Rule | ||
{ | ||
|
||
public function matches(Kdyby\Aop\Pointcut\Method $method) | ||
{ | ||
|
||
} | ||
|
||
} |
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 | ||
|
||
/** | ||
* This file is part of the Kdyby (http://www.kdyby.org) | ||
* | ||
* Copyright (c) 2008 Filip Procházka ([email protected]) | ||
* | ||
* For the full copyright and license information, please view the file license.txt that was distributed with this source code. | ||
*/ | ||
|
||
namespace Kdyby\Aop\Pointcut\Matcher; | ||
|
||
use Kdyby; | ||
use Nette; | ||
|
||
|
||
|
||
/** | ||
* @author Filip Procházka <[email protected]> | ||
*/ | ||
class MethodMatcher extends Nette\Object implements Kdyby\Aop\Pointcut\Rule | ||
{ | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $method; | ||
|
||
|
||
|
||
/** | ||
* @todo visibility | ||
*/ | ||
public function __construct($method) | ||
{ | ||
$this->method = str_replace('\\*', '.*', preg_quote($method)); | ||
} | ||
|
||
|
||
|
||
public function matches(Kdyby\Aop\Pointcut\Method $method) | ||
{ | ||
return preg_match('~^' . $this->method . '\z~i', $method->getName()); | ||
} | ||
|
||
} |
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,29 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the Kdyby (http://www.kdyby.org) | ||
* | ||
* Copyright (c) 2008 Filip Procházka ([email protected]) | ||
* | ||
* For the full copyright and license information, please view the file license.txt that was distributed with this source code. | ||
*/ | ||
|
||
namespace Kdyby\Aop\Pointcut\Matcher; | ||
|
||
use Kdyby; | ||
use Nette; | ||
|
||
|
||
|
||
/** | ||
* @author Filip Procházka <[email protected]> | ||
*/ | ||
class SettingMatcher extends Nette\Object implements Kdyby\Aop\Pointcut\Rule | ||
{ | ||
|
||
public function matches(Kdyby\Aop\Pointcut\Method $method) | ||
{ | ||
|
||
} | ||
|
||
} |
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,43 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the Kdyby (http://www.kdyby.org) | ||
* | ||
* Copyright (c) 2008 Filip Procházka ([email protected]) | ||
* | ||
* For the full copyright and license information, please view the file license.txt that was distributed with this source code. | ||
*/ | ||
|
||
namespace Kdyby\Aop\Pointcut\Matcher; | ||
|
||
use Kdyby; | ||
use Nette; | ||
|
||
|
||
|
||
/** | ||
* @author Filip Procházka <[email protected]> | ||
*/ | ||
class WithinMatcher extends Nette\Object implements Kdyby\Aop\Pointcut\Rule | ||
{ | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $type; | ||
|
||
|
||
|
||
public function __construct($type) | ||
{ | ||
$this->type = Nette\Reflection\ClassType::from($type)->getName(); | ||
} | ||
|
||
|
||
|
||
public function matches(Kdyby\Aop\Pointcut\Method $method) | ||
{ | ||
return isset($method->typesWithin[$this->type]); | ||
} | ||
|
||
} |
Oops, something went wrong.