<commit_before><?php

/**
 * AspectPHP_Advisor_Composite
 *
 * @category PHP
 * @package AspectPHP_Advisor
 * @author <NAME> <<EMAIL>>
 * @copyright 2012 <NAME>
 * @license http://www.opensource.org/licenses/BSD-3-Clause BSD License
 * @link https://github.com/Matthimatiker/AspectPHP
 * @since 28.03.2012
 */

/**
 * Class that encapsulates multiple advisors and behaves like a single advisor.
 *
 * @category PHP
 * @package AspectPHP_Advisor
 * @author <NAME> <<EMAIL>>
 * @copyright 2012 <NAME>
 * @license http://www.opensource.org/licenses/BSD-3-Clause BSD License
 * @link https://github.com/Matthimatiker/AspectPHP
 * @since 28.03.2012
 */
class AspectPHP_Advisor_Composite implements AspectPHP_Advisor, AspectPHP_Pointcut, IteratorAggregate, Countable
{
    
    /**
     * A list of all added advices.
     *
     * @var array(AspectPHP_Advice)
     */
    protected $advices = array();
    
    /**
     * See {@link AspectPHP_Advice::getPointcut()} for details.
     *
     * @return AspectPHP_Pointcut
     */
    public function getPointcut()
    {
        return $this;
    }
    
    /**
     * See {@link AspectPHP_Advice::invoke()} for details.
     *
     * @param AspectPHP_JoinPoint $joinPoint
     */
    public function invoke(AspectPHP_JoinPoint $joinPoint)
    {
        foreach ($this->advices as $advice) {
            /* @var $advice AspectPHP_Advice */
            $advice->invoke($joinPoint);
        }
    }
    
    /**
     * Adds the provided advice to the composite.
     *
     * @param AspectPHP_Advice $advice
     * @return AspectPHP_Advisor_Composite Provides a fluent interface.
     */
    public function add(AspectPHP_Advice $advice)
    {
        $this->advices[] = $advice;
        return $this;
    }
    
    /**
     * Merges all advices of the given composite into this composite.
     *
     * The given composite is not modified.
     *
     * @param AspectPHP_Advisor_Composite $composite
     * @return AspectPHP_Advisor_Composite Provides a fluent interface.
     */
    public function merge(AspectPHP_Advice_Composite $composite)
    {
        $this->advices = array_merge($this->advices, $composite->advices);
        return $this;
    }
    
    /**
     * Returns the number of registered advices.
     *
     * @return integer
     */
    public function count()
    {
        return count($this->advices);
    }
    
    /**
     * Returns an iterator that is used to iterate over all advices
     * in this composite.
     *
     * @return Iterator
     */
    public function getIterator()
    {
        return new ArrayIterator($this->advices);
    }
    
    /**
     * See {@link AspectPHP_Pointcut::matches()} for details.
     *
     * @param string $method
     * @return boolean
     */
    public function matches($method)
    {
        if (count($this) === 0) {
            return false;
        }
        foreach ($this->advices as $advice) {
            /* @var $advice AspectPHP_Advisor */
            if (!$advice->getPointcut()->matches($method)) {
                return false;
            }
        }
        return true;
    }
    
}<commit_msg>fixed naming (variables, type hints, ...)<commit_after><?php

/**
 * AspectPHP_Advisor_Composite
 *
 * @category PHP
 * @package AspectPHP_Advisor
 * @author <NAME> <<EMAIL>>
 * @copyright 2012 <NAME>
 * @license http://www.opensource.org/licenses/BSD-3-Clause BSD License
 * @link https://github.com/Matthimatiker/AspectPHP
 * @since 28.03.2012
 */

/**
 * Class that encapsulates multiple advisors and behaves like a single advisor.
 *
 * @category PHP
 * @package AspectPHP_Advisor
 * @author <NAME> <<EMAIL>>
 * @copyright 2012 <NAME>
 * @license http://www.opensource.org/licenses/BSD-3-Clause BSD License
 * @link https://github.com/Matthimatiker/AspectPHP
 * @since 28.03.2012
 */
class AspectPHP_Advisor_Composite implements AspectPHP_Advisor, AspectPHP_Pointcut, IteratorAggregate, Countable
{
    
    /**
     * A list of all added advisors.
     *
     * @var array(AspectPHP_Advisor)
     */
    protected $advisors = array();
    
    /**
     * See {@link AspectPHP_Advice::getPointcut()} for details.
     *
     * @return AspectPHP_Pointcut
     */
    public function getPointcut()
    {
        return $this;
    }
    
    /**
     * See {@link AspectPHP_Advice::invoke()} for details.
     *
     * @param AspectPHP_JoinPoint $joinPoint
     */
    public function invoke(AspectPHP_JoinPoint $joinPoint)
    {
        foreach ($this->advisors as $advisor) {
            /* @var $advisor AspectPHP_Advisor */
            $advisor->invoke($joinPoint);
        }
    }
    
    /**
     * Adds the provided advisor to the composite.
     *
     * @param AspectPHP_Advisor $advisor
     * @return AspectPHP_Advisor_Composite Provides a fluent interface.
     */
    public function add(AspectPHP_Advisor $advisor)
    {
        $this->advisors[] = $advisor;
        return $this;
    }
    
    /**
     * Merges all advisors of the given composite into this composite.
     *
     * The given composite is not modified.
     *
     * @param AspectPHP_Advisor_Composite $composite
     * @return AspectPHP_Advisor_Composite Provides a fluent interface.
     */
    public function merge(AspectPHP_Advisor_Composite $composite)
    {
        $this->advisors = array_merge($this->advisors, $composite->advisors);
        return $this;
    }
    
    /**
     * Returns the number of registered advisors.
     *
     * @return integer
     */
    public function count()
    {
        return count($this->advisors);
    }
    
    /**
     * Returns an iterator that is used to iterate over all advisors
     * in this composite.
     *
     * @return Iterator
     */
    public function getIterator()
    {
        return new ArrayIterator($this->advisors);
    }
    
    /**
     * See {@link AspectPHP_Pointcut::matches()} for details.
     *
     * @param string $method
     * @return boolean
     */
    public function matches($method)
    {
        if (count($this) === 0) {
            return false;
        }
        foreach ($this->advisors as $advisor) {
            /* @var $advisor AspectPHP_Advisor */
            if (!$advisor->getPointcut()->matches($method)) {
                return false;
            }
        }
        return true;
    }
    
}
{'fraction_non_alphanumeric': 0.11490097453630933, 'fraction_numerical': 0.008487896887771141, 'mean_word_length': 2.157816377171216, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 41, 'https://': 4, 'lorem ipsum': 0, 'www.': 4, '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': '117163', 'n_tokens_mistral': 2004, 'n_tokens_neox': 1933, 'n_words': 451}