Ray.Aop icon indicating copy to clipboard operation
Ray.Aop copied to clipboard

New functionality

Open edsonlsjj opened this issue 3 years ago • 1 comments

Added: AllPublicMethods attribute when used as class attribute it takes all public methods to intercept except __constructor

edsonlsjj avatar Aug 17 '22 13:08 edsonlsjj

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

sonarqubecloud[bot] avatar Aug 17 '22 13:08 sonarqubecloud[bot]

Codecov Report

Merging #191 (d0758bf) into 2.x (bb0e70d) will not change coverage. The diff coverage is 100.00%.

@@             Coverage Diff             @@
##                 2.x      #191   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity       171       181   +10     
===========================================
  Files             29        30    +1     
  Lines            507       521   +14     
===========================================
+ Hits             507       521   +14     
Impacted Files Coverage Δ
src/Annotation/AllPublicMethods.php 100.00% <100.00%> (ø)
src/Bind.php 100.00% <100.00%> (ø)
src/MethodMatch.php 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov[bot] avatar Sep 07 '22 01:09 codecov[bot]

@edsonlsjj I think it is a good idea to match only public methods. But then why not just create that matcher?

$pointcut = new Pointcut(
    (new Matcher())->any(), // any class
    (new Matcher())->isPublic(), // public method exclude PHP built-in method
    [new WeekendBlocker()]
);

(Sorry for the late reply!)

koriym avatar Sep 07 '22 10:09 koriym

@edsonlsjj I have reconsidered. This can be handled without code changes, just a combination of existing matches.

$mather = new Matcher();
$pointcut = new Pointcut(
    $mather->any(), // any class
    $mather->logicalNot(
        $mather->startsWith('__')
    ),
    [new WeekendBlocker()]
);

koriym avatar Sep 09 '22 07:09 koriym

@edsonlsjj If you still have questions, feel free to re-open it!

koriym avatar Sep 28 '22 05:09 koriym