<commit_before><?php

namespace App\Http\Controllers;

use App\Test;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;

class TestController extends Controller
{

  public function create($id)
  {
      return view('tests/create', ["id_exercise" => $id]);
  }

  protected function validator(array $data)
  {
      return Validator::make($data, [
          'name' => 'required|max:255',
          'description' => 'required|max:255',
          'code' => 'required'
      ]);
  }

  public function store(Request $request, $id)
  {
    $validator = $this->validator($request->all());
    if($validator->fails()){
      return redirect()->back()->withErrors($validator->errors());
    }
    $test = new Test;
    $test->id_exercise = $id;
    $test->name = $request->input('name');
    $test->description = $request->input('description');<commit_msg>Update TestController.php<commit_after><?php

namespace App\Http\Controllers;

use App\Test;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;

class TestController extends Controller
{

  public function create($id)
  {
      return view('exercises/tests/create', ["id_exercise" => $id]);
  }

  protected function validator(array $data)
  {
      return Validator::make($data, [
          'name' => 'required|max:255',
          'description' => 'required|max:255',
          'code' => 'required'
      ]);
  }

  public function store(Request $request, $id)
  {
    $validator = $this->validator($request->all());
    if($validator->fails()){
      return redirect()->back()->withErrors($validator->errors());
    }
    $test = new Test;
    $test->id_exercise = $id;
    $test->name = $request->input('name');
    $test->description = $request->input('description');
{'fraction_non_alphanumeric': 0.17386363636363636, 'fraction_numerical': 0.006818181818181818, 'mean_word_length': 3.538659793814433, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 33, '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': '3429668', 'n_tokens_mistral': 541, 'n_tokens_neox': 544, 'n_words': 102}