'Missing class import via use statement

I'm trying to fix the pipeline and I get the following 2 warning

  1. $secretKeyString = new \java("java.lang.String", $secretKey);

  2. $pbbEncryptAES = new \java("my.com.onlinepayment.encoders.PBE_encrypt_AES");:

Missing class import via use statement (line '124', column '30').

for the following code:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Response;
use java;

class AlbPaymexController extends Controller
{
    protected $responses = [
        'B2C91BC3'              => "",
        'PX_VERSION'            => "",
        'PX_TRANSACTION_TYPE'   => "",
   
 
    ];
    

    private function generateSignature( array $payload, string $secretKey, &$calculated = null )
    {
        if(array_key_exists("PX_SIG", $payload)) 
            unset($payload['PX_SIG']);

        $plaintext = implode("\n" , $payload)."\n";
        $calculated["payload"] = $payload;
        $calculated["plain"] = $plaintext;
        $calculated["secret"] = $secretKey;

        $secretKeyString = new \java("java.lang.String", $secretKey);
        $pbbEncryptAES = new \java("my.com.onlinepayment.encoders.PBE_encrypt_AES");

        try{ 
            $result = $pbbEncryptAES->encrypt(
                $secretKeyString->getBytes(),
                $plaintext,
                "AES"
            );
            return $calculated["signature"] = java_values($result);
        } catch( \java_InternalException $ex ) {
            throw new Exception("Failed to generate signature");
        }
    }
}

I got this error while running my pipeline in GitLab. I'm very new to GitLab and not sure how to fix this issue. It will be very helpful if anyone know how to fix it. Hoping to get fix before the submisson date



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source