class-constants

Get class constant names in php?

I have a php class with some class constants that indicate the status of an instance. When I'm using the class, after I run some methods on it, I do some checks to make sure that the status is what I expect it to be. For instance, after calling some methods, I expect the status to be MEANINGFUL_STATUS_NAME. $objInstance->method1();...

How to I make private class constants in Ruby

In Ruby how does one create a private class constant? (i.e one that is visible inside the class but not outside) class Person SECRET='xxx' # How to make class private?? def show_secret puts "Secret: #{SECRET}" end end Person.new.show_secret puts Person::SECRET # I'd like this to fail ...

[PHP]: Use function return as array data in static class definition.

I'm having problems with this class definition because of the definition of $directories. Please help: <?php ..... class Config { public static $directories = array( "resources" => realpath(__DIR__), "root" => $_SERVER['DOCUMENT_ROOT'], "branch" => $_SERVER['DOCUMENT_ROOT'] . "/branch", "templates" => re...

PHP Class variables with Constants

I am getting a parse error on the lines with the constant (DEPLOYMENT). Why is this now allowed, or am I missing something. Parse error: parse error, expecting `')'' in class UploadComponent extends Object { private $config = array( 'accessKey' => 'XXXX', 'secretKey' => 'XXXX', 'images' => array( ...