verify_capability(); if ( $error ) { return $error; } $scripts = ( new Script() )->list(); $formatted = array_map( fn( $dto ) => $dto->to_array(), $scripts ); return $this->respond_success_json( [ 'scripts' => $formatted, ] ); } catch ( Throwable $t ) { return $this->respond_error_json( [ 'message' => $t->getMessage(), 'code' => 'internal_server_error', ], 500 ); } } }