Now the problem is that it runs the command twice. And I know the problem is in line 26 because I checked. But I dont know why it is doing this and what is going wrong here. I pasted the link with screenshots of the problem and the extra files I use.
This is an ACME client coding problem and is not related to Let's Encrypt. Use a PHP debugger to set a breakpoint and step through the code to see what's happening.
It looks like your handle function is called more than once, because the "Initializing ACME v2 environment..." message should only appear once. This means there is more than one instance of ACMECert active.