<commit_before><?php

namespace App\Formatters\Openinghours;

use Illuminate\Database\Eloquent\Model;

/**
 * Json formatter class for Openinghours
 * renders given objects into json (base Laravel behavior)
 */
class JsonFormatter extends BaseFormatter
{
    /**
     * @var string
     */
    protected $supportFormat = 'application/json';
    /**
     * render
     * @param Illuminate\Database\Eloquent\Model $data
     * @return $this
     */
    public function render($data)
    {
        $this->output = array_values($data);
        if (count($this->output) === 1) {
            $this->output = json_encode($this->output[0]);
        }

        return $this;
    }
}<commit_msg>OPEN-78 fix collection with one object must remain array<commit_after><?php

namespace App\Formatters\Openinghours;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Collection;

/**
 * Json formatter class for Openinghours
 * renders given objects into json (base Laravel behavior)
 */
class JsonFormatter extends BaseFormatter
{
    /**
     * @var string
     */
    protected $supportFormat = 'application/json';
    /**
     * render
     * @param Illuminate\Database\Eloquent\Model $data
     * @return $this
     */
    public function render($data)
    {
        $this->output = array_values($data);
        if (count($this->output) === 1 && !($this->output instanceof Collection)) {
            $this->output = json_encode($this->output[0]);
        }

        return $this;
    }
}
{'fraction_non_alphanumeric': 0.12866666666666668, 'fraction_numerical': 0.004, 'mean_word_length': 2.7525, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 12, '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': '2549343', 'n_tokens_mistral': 441, 'n_tokens_neox': 438, 'n_words': 103}