Download the PHP package jced-artem/legacy-adapter without Composer
On this page you can find all versions of the php package jced-artem/legacy-adapter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jced-artem/legacy-adapter
More information about jced-artem/legacy-adapter
Files in jced-artem/legacy-adapter
Package legacy-adapter
Short Description Flyweight-adapter for using legacy code in modern frameworks with lazy refactor.
License MIT
Homepage https://github.com/jced-artem
Informations about the package legacy-adapter
legacy-adapter
Flyweight-adapter for using legacy code in modern frameworks with lazy refactor.
Install
Example
You can use this legacy file anywhere simply:
or
Methods available in flyweight
getContent()
- get echo/print/etc after include file
get($name)
- get variable from file
hasVariable($name)
- check if variable exists
set($name, $value)
- set variable value
hasFunction($name)
- check if function exists
call($name, array $parameters = [])
- call function
hasClassDeclared($className)
- check if class exists
innerClassGetConstant($className, $constantName)
- get constsnt from class
innerClassGetInstance($className)
- get instance of class which was declared in file
innerClassCallStatic($className, $methodName, array $parameters = [])
- call static function of class declared in file
getFunctionNamesList()
- list of all function
getVariableNamesList()
- list of all variables
getClassNamesList()
- list of all classes
Weakness
- Singleton-like. You can't create 2 objects because you can't include file 2 times;
- Global functions and classes are still global;
- Performance can be 2 times lower then native usage include();