<commit_before><?php

namespace WalletLogger;

use Illuminate\Database\Query\Builder;
use Slim\Http\Request;
use Slim\Http\Response;

class ItemsController implements ItemsInterface
{
    protected $table;
    protected $order_by;

    public function __construct(Builder $table)
    {
        /** @var Builder table */
        $this->table = $table;
        $this->order_by = 'id';
    }

    public function listItems(Request $request, Response $response, Array $args)
    {
        $output = [
            'status' => 204,
            'message' => 'No Content',
            'total_items' => 0,
            'items' => null,
        ];

        $items = $this->table->orderBy($this->order_by)->get()->where('deleted_at', null);
        if (count($items) > 0) {
            $output = [
                'status' => 200,
                'message' => 'OK',
                'total_items' => count($items),
                'items' => $items,
            ];
        }

        return $response->withStatus($output['status'])->withJson($output);
    }

    public function getItem(Request $request, Response $response, Array $args)
    {<commit_msg>Update status code in listing items, using 204 we can't provide content, so change to 404 (Not Found)<commit_after><?php

namespace WalletLogger;

use Illuminate\Database\Query\Builder;
use Slim\Http\Request;
use Slim\Http\Response;

class ItemsController implements ItemsInterface
{
    protected $table;
    protected $order_by;

    public function __construct(Builder $table)
    {
        /** @var Builder table */
        $this->table = $table;
        $this->order_by = 'id';
    }

    public function listItems(Request $request, Response $response, Array $args)
    {
        $output = [
            'status' => 404,
            'message' => 'Not Found',
            'total_items' => 0,
            'items' => null,
        ];

        $items = $this->table->orderBy($this->order_by)->get()->where('deleted_at', null);
        if (count($items) > 0) {
            $output = [
                'status' => 200,
                'message' => 'OK',
                'total_items' => count($items),
                'items' => $items,
            ];
        }

        return $response->withStatus($output['status'])->withJson($output);
    }

    public function getItem(Request $request, Response $response, Array $args)
    {
{'fraction_non_alphanumeric': 0.14382117250105442, 'fraction_numerical': 0.009278785322648671, 'mean_word_length': 2.1128608923884515, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 39, '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': '5778554', 'n_tokens_mistral': 704, 'n_tokens_neox': 669, 'n_words': 159}