Meth – A global helper function
I use functions like this a lot during development. I tuck them into a prepend file so they’re only available on my local machine. My first was shout()
function shout() { echo "<pre>"; foreach(func_get_args() as $var) { print_r($var); } echo "<\/pre>"; # (sic) die(); }
Great for looking at data.
But I very often found myself wanting to see the API for an object without having to look it up. So I wrote meth()
function meth($obj, $method_name = null) { $ref = new ReflectionClass($obj); echo "<pre>"; foreach ($ref->getMethods() as $method) { if(!$method_name || $method_name == $method->name) { echo $method; } } echo "<\/pre>"; # (sic) die(); } meth($this->Session, 'read'); # /** # * Used to read a session values for a key or return values for all keys. # * # * In your controller: $this->Session->read('Controller.sessKey'); # * Calling the method without a param will return all session vars # * # * @param string $name the name of the session key you want to read # * @return mixed value from the session vars # * @access public # */ # Method [ public method read ] { # @@ C:\web\kbya\dev\src\cake\libs\controller\components\session.php 150 - 156 # # - Parameters [1] { # Parameter #0 [ $name = NULL ] # } # }
Pretty handy so far.
Oh ya, and here’s the VHost line
php_value auto_prepend_file "/home/kev/web/prepend.php"
Comments(0)