<commit_before><?php
declare(ENCODING = 'utf-8');
namespace F3\FLOW3\AOP\Advice;

/*                                                                        *
 * This script belongs to the FLOW3 framework.                            *
 *                                                                        *
 * It is free software; you can redistribute it and/or modify it under    *
 * the terms of the GNU Lesser General Public License as published by the *
 * Free Software Foundation, either version 3 of the License, or (at your *
 * option) any later version.                                             *
 *                                                                        *
 * This script is distributed in the hope that it will be useful, but     *
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
 * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
 * General Public License for more details.                               *
 *                                                                        *
 * You should have received a copy of the GNU Lesser General Public       *
 * License along with the script.                                         *
 * If not, see http://www.gnu.org/licenses/lgpl.html                      *
 *                                                                        *
 * The TYPO3 project - inspiring people to share!                         *
 *                                                                        */

/**
 * The advice chain holds a number of subsequent advices that
 * match a given join point and calls the advices in the right order.
 *
 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
 * @scope prototype
 */
class AdviceChain {

	/**
	 * @var array An array of \F3\FLOW3\AOP\Advice objects which form the advice chain
	 */
	protected $advices;

	/**
	 * @var integer The number of the next advice which will be invoked on a proceed() call
	 */
	protected $adviceIndex = -1;

	/**
	 * Initializes the advice chain
	 *
	 * @param array $advices An array of \F3\FLOW3\AOP\Advice\AdviceInterface compatible objects which form the chain of advices
	 * @param \F3\FLOW3\AOP\ProxyInterface $proxy A reference to the proxy object using the advice chain
	 * @return void
	 * @author <NAME> <<EMAIL>>
	 */
	public function __construct(&$advices, \F3\FLOW3\AOP\ProxyInterface &$proxy) {
		$this->advices = $advices;
		$this->proxy = $proxy;
	}

	/**
	 * An advice usually calls (but doesn't have to neccessarily) this method
	 * in order to proceed with the next advice in the chain. If no advice is
	 * left in the chain, the proxy classes' method invokeJoinpoint() will finally
	 * be called.
	 *
	 * @param  \F3\FLOW3\AOP\JoinPointInterface $joinPoint The current join point (ie. the context)
	 * @return mixed Result of the advice or the original method of the target class
	 * @author <NAME> <<EMAIL>>
	 */
	public function &proceed(\F3\FLOW3\AOP\JoinPointInterface &$joinPoint) {
		$this->adviceIndex++;
		if ($this->adviceIndex < count($this->advices)) {
			$result = $this->advices[$this->adviceIndex]->invoke($joinPoint);
		} else {
			$result = $this->proxy->FLOW3_AOP_Proxy_invokeJoinpoint($joinPoint);
		}
		return $result;
	}

	/**
	 * Re-initializes the index to start a new run through the advice chain
	 *
	 * @return void
	 * @author <NAME> <<EMAIL>>
	 */
	public function rewind() {
		$this->adviceIndex = -1;
	}<commit_msg>[~TASK] FLOW3 (AOP): Make proceed() no longer return-by-ref<commit_after><?php
declare(ENCODING = 'utf-8');
namespace F3\FLOW3\AOP\Advice;

/*                                                                        *
 * This script belongs to the FLOW3 framework.                            *
 *                                                                        *
 * It is free software; you can redistribute it and/or modify it under    *
 * the terms of the GNU Lesser General Public License as published by the *
 * Free Software Foundation, either version 3 of the License, or (at your *
 * option) any later version.                                             *
 *                                                                        *
 * This script is distributed in the hope that it will be useful, but     *
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
 * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
 * General Public License for more details.                               *
 *                                                                        *
 * You should have received a copy of the GNU Lesser General Public       *
 * License along with the script.                                         *
 * If not, see http://www.gnu.org/licenses/lgpl.html                      *
 *                                                                        *
 * The TYPO3 project - inspiring people to share!                         *
 *                                                                        */

/**
 * The advice chain holds a number of subsequent advices that
 * match a given join point and calls the advices in the right order.
 *
 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
 * @scope prototype
 */
class AdviceChain {

	/**
	 * @var array An array of \F3\FLOW3\AOP\Advice objects which form the advice chain
	 */
	protected $advices;

	/**
	 * @var integer The number of the next advice which will be invoked on a proceed() call
	 */
	protected $adviceIndex = -1;

	/**
	 * Initializes the advice chain
	 *
	 * @param array $advices An array of \F3\FLOW3\AOP\Advice\AdviceInterface compatible objects which form the chain of advices
	 * @param \F3\FLOW3\AOP\ProxyInterface $proxy A reference to the proxy object using the advice chain
	 * @return void
	 * @author <NAME> <<EMAIL>>
	 */
	public function __construct(&$advices, \F3\FLOW3\AOP\ProxyInterface &$proxy) {
		$this->advices = $advices;
		$this->proxy = $proxy;
	}

	/**
	 * An advice usually calls (but doesn't have to neccessarily) this method
	 * in order to proceed with the next advice in the chain. If no advice is
	 * left in the chain, the proxy classes' method invokeJoinpoint() will finally
	 * be called.
	 *
	 * @param  \F3\FLOW3\AOP\JoinPointInterface $joinPoint The current join point (ie. the context)
	 * @return mixed Result of the advice or the original method of the target class
	 * @author <NAME> <<EMAIL>>
	 */
	public function proceed(\F3\FLOW3\AOP\JoinPointInterface &$joinPoint) {
		$this->adviceIndex++;
		if ($this->adviceIndex < count($this->advices)) {
			$result = $this->advices[$this->adviceIndex]->invoke($joinPoint);
		} else {
			$result = $this->proxy->FLOW3_AOP_Proxy_invokeJoinpoint($joinPoint);
		}
		return $result;
	}

	/**
	 * Re-initializes the index to start a new run through the advice chain
	 *
	 * @return void
	 * @author <NAME> <<EMAIL>>
	 */
	public function rewind() {
		$this->adviceIndex = -1;
	}
{'fraction_non_alphanumeric': 0.09024149131478605, 'fraction_numerical': 0.00635503459963282, 'mean_word_length': 1.7794348508634223, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 42, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5891028', 'n_tokens_mistral': 1858, 'n_tokens_neox': 1751, 'n_words': 689}