-
Notifications
You must be signed in to change notification settings - Fork 185
Description
Really great work so far. I suspect this might come from the Symfony project or something, but I would appreciate some documentation on the high level structure to help me make some larger changes to this project. I realize this is a big ask, so I've started a bit of the work. Here's what I've understood so far (and perhaps a starting point for the documentation):
- Console\Command provides the command line interface via a very self-explanatory class; offers some configuration (parameterization) that all comes from a Symfony parent class. Importantly, it is expected to hold an Obfuscator which defines the method Obfuscate. This can be considered the basic entry point (as the wrapper code to create an Application is cookiecutter)
- _Node\Visitor_s are the important tools which decide how to deal with the semantic content of the code. After parsing via PHP Parser, each node is "visited". Each visitor inherits from the abstract class Scrambler (scrambler.php). Each of these visitors define a function enterNode that defines a condition that decides whether to call the scramble function or not based on properties of the node (this probably comes from PhpParser's NodeVisitorAbstract, but needs to be checked)
- Events are currently cookie cutter wrappers for dealing with files. Seems like a compatibility layer for another library (to actually enter a file). Needs more detail about how it gets integrated (assuming there's ever plausibly going to be non-file events a user wants to interact with).
- StringScrambler defines the class which actually decides how to scramble a variable. Used by the node visitors.
My main interest in this is modifying it so it can scramble public class functions when obfuscating a "full project" (aka we know all the calls). As far as I can tell, that is going to be a challenge because the node visitor only sees the class itself, not the other files that may call it... that said, the function scrambling must already do this, so it seems to not be impossible?
THIS THREAD DISCUSSES TWO SEPARATE ISSUES: documentation of the code "structure" and the implementation of a mechanism for obfuscating non-private methods.