Download the PHP package marcin-orlowski/lockpick without Composer
On this page you can find all versions of the php package marcin-orlowski/lockpick. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download marcin-orlowski/lockpick
More information about marcin-orlowski/lockpick
Files in marcin-orlowski/lockpick
Download marcin-orlowski/lockpick
More information about marcin-orlowski/lockpick
Files in marcin-orlowski/lockpick
Vendor marcin-orlowski
Package lockpick
Short Description Helps accessing protected/private members/consts of foreign objects.
License MIT
Homepage https://github.com/MarcinOrlowski/php-lockpick
Package lockpick
Short Description Helps accessing protected/private members/consts of foreign objects.
License MIT
Homepage https://github.com/MarcinOrlowski/php-lockpick
Please rate this library. Is it a good library?
Informations about the package lockpick
Lockpick
Collection of PHP helper methods allowing easy access to protected or private properties and constants of objects or classes as well as allowing to call such non-public methods. This library is mostly useful while creating unit tests for your code.
Installation
Usage
As all methods come as set of static methods, so you just need to add related use
to your
code class and all methods should be simply available via static reference Lockpick::...
:
Available methods
Notes:
- The
$clsOrObj
parameter can be eitherobject
or class name (string
) - The
Lockpick::call()
argument$args
now accepts single parameters w/oarray
wrapping (socall(..., $arg1)
is now valid and equivalent tocall(..., [ $arg1 ])
) as it will be automatically wrapped under the hood. - If you want to actually pass
array
as single argument to called function you must wrap it into another array, like this:call(..., [[ $arg1, $arg2 ]])
. Default is empty array which means no arguments will be passed to the called method.
Method | Description |
---|---|
call($clsOrObj, string $methodName, mixed $args): mixed | Calls object/class protected/private method |
getProperty($clsOrObj, string $name): mixed | Returns value of protected/private property |
setProperty($clsOrObj, string $name, mixed $value): mixed | Sets value of protected/private property |
getConstant($clsOrObj, string $name): mixed | Returns value of protected/private constant |
getMethodVisibility($clsOrObj, string $name): Visibility | Returns visibility of class method |
getPropertyVisibility($clsOrObj, string $name): Visibility | Returns visibility of class property |
getConstantVisibility($clsOrObj, string $name): Visibility | Returns visibility of class constant |
License
- Written and copyrighted ©2014-2024 by Marcin Orlowski
- Open-sourced software licensed under the MIT license
- ASCII Art created using https://textkool.com
All versions of lockpick with dependencies
PHP Build Version
Package Version
The package marcin-orlowski/lockpick contains the following files
Loading the files please wait ....