<commit_before><?php
/**
 * Go! AOP framework
 *
 * @copyright Copyright 2013, <NAME> <<EMAIL>>
 *
 * This source file is subject to the license that is bundled
 * with this source code in the file LICENSE.
 */

namespace Go\Aop\Framework;

use Go\Aop\Intercept\Interceptor;
use Go\Aop\Intercept\Invocation;
use Go\Aop\Intercept\Joinpoint;
use Go\Aop\Pointcut;

/**
 * Dynamic invocation matcher combines a pointcut and interceptor.
 *
 * For each invocation interceptor asks the pointcut if it matches the invocation.
 * Matcher will receive reflection point, object instance and invocation arguments to make a decision
 */
class DynamicInvocationMatcherInterceptor extends BaseInterceptor
{
    /**
     * Instance of pointcut to dynamically match joinpoints with args
     *
     * @var Pointcut
     */
    protected $pointcut;

    /**
     * Dynamic matcher constructor
     *
     * @param Pointcut $pointcut Instance of dynamic matcher
     * @param Interceptor $interceptor Instance of interceptor to invoke
     */
    public function __construct(Pointcut $pointcut, Interceptor $interceptor)
    {
        $this->pointcut     = $pointcut;
        parent::__construct($interceptor);
    }

    /**
     * Serializes an interceptor into string representation
     *
     * @return string the string representation of the object or null
     */
    public function serialize()
    {
        return serialize(array($this->pointcut, $this->adviceMethod));
    }

    /**
     * Unserialize an interceptor from the string
     *
     * @param string $serialized The string representation of the object.
     * @return void
     */
    public function unserialize($serialized)
    {
        list($this->pointcut, $this->adviceMethod) = unserialize(($serialized));
    }

    /**
     * Method invoker
     *
     * @param Joinpoint $joinpoint the method invocation joinpoint
     *
     * @return mixed the result of the call to {@see Joinpoint->proceed()}
     */
    final public function invoke(Joinpoint $joinpoint)
    {
        if ($joinpoint instanceof Invocation) {
            if ($this->pointcut->matches($joinpoint->getStaticPart(), $joinpoint->getThis(), $joinpoint->getArguments())) {
                return $this->adviceMethod->invoke($joinpoint);<commit_msg>Break inheritance for DynamicInvocationMatcherInterceptor, as no need in this<commit_after><?php
/**
 * Go! AOP framework
 *
 * @copyright Copyright 2013, <NAME> <<EMAIL>>
 *
 * This source file is subject to the license that is bundled
 * with this source code in the file LICENSE.
 */

namespace Go\Aop\Framework;

use Go\Aop\Intercept\Interceptor;
use Go\Aop\Intercept\Invocation;
use Go\Aop\Intercept\Joinpoint;
use Go\Aop\Pointcut;
use Serializable;

/**
 * Dynamic invocation matcher combines a pointcut and interceptor.
 *
 * For each invocation interceptor asks the pointcut if it matches the invocation.
 * Matcher will receive reflection point, object instance and invocation arguments to make a decision
 */
class DynamicInvocationMatcherInterceptor implements Interceptor, Serializable
{
    /**
     * Instance of pointcut to dynamically match joinpoints with args
     *
     * @var Pointcut
     */
    protected $pointcut;

    /**
     * Overloaded property for storing instance of Interceptor
     *
     * @var Interceptor
     */
    protected $interceptor;

    /**
     * Dynamic matcher constructor
     *
     * @param Pointcut $pointcut Instance of dynamic matcher
     * @param Interceptor $interceptor Instance of interceptor to invoke
     */
    public function __construct(Pointcut $pointcut, Interceptor $interceptor)
    {
        $this->pointcut    = $pointcut;
        $this->interceptor = $interceptor;
    }

    /**
     * Serializes an interceptor into string representation
     *
     * @return string the string representation of the object or null
     */
    public function serialize()
    {
        return serialize([$this->pointcut, $this->interceptor]);
    }

    /**
     * Unserialize an interceptor from the string
     *
     * @param string $serialized The string representation of the object.
     * @return void
     */
    public function unserialize($serialized)
    {
        list($this->pointcut, $this->interceptor) = unserialize($serialized);
    }

    /**
     * Method invoker
     *
     * @param Joinpoint $joinpoint the method invocation joinpoint
     *
     * @return mixed the result of the call to {@see Joinpoint->proceed()}
     */
    final public function invoke(Joinpoint $joinpoint)
    {
        if ($joinpoint instanceof Invocation) {
            if ($this->pointcut->matches($joinpoint->getStaticPart(), $joinpoint->getThis(), $joinpoint->getArguments())) {
                return $this->interceptor->invoke($joinpoint);
{'fraction_non_alphanumeric': 0.09587607284906845, 'fraction_numerical': 0.0016746912288046892, 'mean_word_length': 2.9651452282157678, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 36, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3519357', 'n_tokens_mistral': 1300, 'n_tokens_neox': 1265, 'n_words': 412}