public function addConstant($value, $name = '')
    {
        if (strlen($value) == 0) {
            throw new Exception('No value supplied');
        }

        // If no name is supplied use the value as name
        if (strlen($name) == 0) {
            if (is_string($value)) {
                $name = $value;
            } else {
                throw new Exception('No name supplied');
            }
        }

        if (array_key_exists($name, $this->constants)) {
            throw new Exception('A constant of the name (' . $name . ') does already exist.');
        }

        $this->constants[$name] = $value;
    }
public function addConstant($value, $name = '')
    {
        if (strlen($value) == 0) {
            throw new Exception('No value supplied');
        }

        // If no name is supplied use the value as name
        if (strlen($name) == 0) {
            if (is_string($value)) {
                $name = $value;
            } else {
                throw new Exception('No name supplied');
            }
        }

        if (array_key_exists($name, $this->constants)) {
            throw new Exception('A constant of the name (' . $name . ') does already exist.');
        }

        $this->constants[$name] = $value;
    }
public function addConstant ( $ value , $ name = '' ) { if ( strlen ( $ value ) == 0 ) { throw new Exception ( 'No value supplied' ) ; } // If no name is supplied use the value as name if ( strlen ( $ name ) == 0 ) { if ( is_string ( $ value ) ) { $ name = $ value ; } else { throw new Exception ( 'No name supplied' ) ; } } if ( array_key_exists ( $ name , $ this -> constants ) ) { throw new Exception ( 'A constant of the name (' . $ name . ') does already exist.' ) ; } $ this -> constants [ $ name ] = $ value ; }
Adds a constant to the class. If no name is supplied and the value is a string the value is used as name otherwise exception is raised

@param mixed $value
@param string $name
@throws Exception
Adds a constant to the class . If no name is supplied and the value is a string the value is used as name otherwise exception is raised