Sure, I don't see why not. It should be really straightforward what's allowed and what not.
Taking the downloads app and renaming any "downloads" references to "links" or "jobs" and "file" to "link" or "job"
Same applies also to e.g. taking a complete class or method.. It should be really common sense that that's not allowed, or?:(
E.g. once our IPS\nexus\Money class was copied into an own app to provide payment options.. that's a big NO!
Copying some code which runs a query and which calls another method =>
That said, the code which you've posted it a great candidate to be extracted into an own method, so I have suggest this change internally.