I am making a function in my controller that imports a lot of data from an API. The code is working and is clear, but I also want a console command to start this import. I can copy-paste the code, but when I do that I have to edit the code twice when I am going to make some changes.
I saw on google that there is an Utility class in older versions of cakephp but I can’t find it for cakephp5. How can I make it possible without copy-pasting the code?