Read kubernetes job in PHP

I’m very new in PHP. I’ve been looking around, but couldn’t find an example to guide myself after.

I have a k8s job and some PHP code. In PHP, I need to test if the job is complete.

Here’s the status part of my job:

status:
  conditions:
    - type: Complete
      status: 'True'
      lastProbeTime: '2023-09-15T08:54:52Z'
      lastTransitionTime: '2023-09-15T08:54:52Z'
  startTime: '2023-09-15T08:54:14Z'
  completionTime: '2023-09-15T08:54:52Z'
  succeeded: 1
  uncountedTerminatedPods: {}
  ready: 0

And this is the PHP code I am using:

    public function wait_for_copy_job($namespace)
    {
        $API = new KubernetesAPIJob();
        $copy_data = $API->read($namespace, "copy-user-data");
        return $copy_status->status->conditions[0]->type;
    }
            while ($copy_status != "Complete"){
                echo "not done yet";
            }

            echo "done";

Needless to say that my while loop goes on forever, even though the job status is Complete. What exactly am I doing wrong?