Hello Julien!
I have looked at your code on git hub. I am new to this and code development. When you say copy/paste where in the enrol\cohort\lib.php file do you paste your code? Did you put it at the end or in a specific location within the file? Any assistance you can provide would be truly appreciated. Thanks!