<commit_before><?php

namespace Detail\Apigility\Rest\Resource;

use ZF\ApiProblem\ApiProblem;
use ZF\ApiProblem\ApiProblemResponse;
use ZF\Rest\Resource as BaseResource;

use Detail\Apigility\Exception;

class Resource extends BaseResource
{
    public function patchMultiple($ids, $data)
    {
        if (!is_array($ids)) {
            throw new Exception\InvalidArgumentException(
                sprintf(
                    'Data provided to %s must be an array of identifiers; received "%s"',
                    __FUNCTION__,
                    gettype($data)
                )
            );
        }

        if (is_array($data)) {
            $data = (object) $data;
        }

        if (!is_object($data)) {
            throw new Exception\InvalidArgumentException(
                sprintf(
                    'Data provided to create must be either an array or object; received "%s"',
                    gettype($data)
                )
            );
        }

        $events = $this->getEventManager();
        $event = $this->prepareEvent(__FUNCTION__, array('ids' => $ids, 'data' => $data));

        $results = $events->triggerUntil(
            $event,
            function ($result) {
                return ($result instanceof ApiProblem || $result instanceof ApiProblemResponse);
            }
        );

        $last = $results->last();

        if (!is_array($last) && !is_object($last)) {
            return $data;
        }

        return $last;
    }
}<commit_msg>Switch triggerUnti lfunction (deprecated) to trigger function<commit_after><?php

namespace Detail\Apigility\Rest\Resource;

use ZF\ApiProblem\ApiProblem;
use ZF\ApiProblem\ApiProblemResponse;
use ZF\Rest\Resource as BaseResource;

use Detail\Apigility\Exception;

class Resource extends BaseResource
{
    public function patchMultiple($ids, $data)
    {
        if (!is_array($ids)) {
            throw new Exception\InvalidArgumentException(
                sprintf(
                    'Data provided to %s must be an array of identifiers; received "%s"',
                    __FUNCTION__,
                    gettype($data)
                )
            );
        }

        if (is_array($data)) {
            $data = (object) $data;
        }

        if (!is_object($data)) {
            throw new Exception\InvalidArgumentException(
                sprintf(
                    'Data provided to create must be either an array or object; received "%s"',
                    gettype($data)
                )
            );
        }

        $events = $this->getEventManager();
        $event = $this->prepareEvent(__FUNCTION__, array('ids' => $ids, 'data' => $data));

        $results = $events->trigger(
            $event,
            function ($result) {
                return ($result instanceof ApiProblem || $result instanceof ApiProblemResponse);
            }
        );

        $last = $results->last();

        if (!is_array($last) && !is_object($last)) {
            return $data;
        }

        return $last;
    }
}
{'fraction_non_alphanumeric': 0.11289793239251723, 'fraction_numerical': 0.0, 'mean_word_length': 1.6949602122015914, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '4221945', 'n_tokens_mistral': 822, 'n_tokens_neox': 778, 'n_words': 196}