codeigniter - Proper way to utilize macro in PHP for __FILENAME__ in called function -



codeigniter - Proper way to utilize macro in PHP for __FILENAME__ in called function -

i'm working phpunit within codeigniter , have created back upwards method allows me dynamically dump output file named after invoking function file stored in directory tree identical path of invoking file.

the function working wonderfully (implemented within ciunit_testcase) , invoked such:

$this->dumpoutputtofile($out, __file__, __class__, __function__);

i far rather doing along lines of

$this->dumpoutputtofile($out);

or (though still hacky)

$this->dumpoutputtofile($out, $this);

the problem within "dumpoutputtofile()" method magic macros no longer exist (of course) , unfortunately using debug_backtrace() not of help within values returned not include 'file' or 'line' attributes (though available outside call.)

so i'm looking the cleanest/simplest way implement phone call dumpoutputtofile() little utilize of parameters, etc.

macro fine aren't available. utilize of debug_backtrace fine not providing proper info within. i've heard xdebug thing create things little simpler me along these lines i've not yet had bandwidth install that.

here illustration of code i'm using within function access values:

$mydbg = debug_backtrace(); print "printing array keys 'inside' ({$mydbg[0]['function']}) function:\n"; print_r(array_keys($mydbg['0'])); print "\n\nprinting array keys 'parent' ({$mydbg[1]['function']}) function:\n"; print_r(array_keys($mydbg['1']));

and results i'm getting... values i'm wanting not available calling function:

printing array keys 'inside' (dumpoutputtofile) function: array ( [0] => file [1] => line [2] => function [3] => class [4] => object [5] => type [6] => args ) printing array keys 'parent' (testindex) function: array ( [0] => function [1] => class [2] => object [3] => type [4] => args )

php codeigniter macros phpunit

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

c# - Create a Notification Object (Email or Page) At Run Time -- Dependency Injection or Factory -

Set Up Of Common Name Of SSL Certificate To Protect Plesk Panel -