Packages

  • Nette
    • Application
    • Caching
    • Collections
    • Config
    • Forms
    • IO
    • Loaders
    • Mail
    • Reflection
    • Security
    • Templates
    • Web
  • None
  • PHP

Classes

  • NArrayTools
  • NCallback
  • NComponent
  • NComponentContainer
  • NConfigurator
  • NDateTime53
  • NDebug
  • NEnvironment
  • NFramework
  • NFreezableObject
  • NGenericRecursiveIterator
  • NImage
  • NImageMagick
  • NInstanceFilterIterator
  • NObject
  • NObjectMixin
  • NPaginator
  • NRecursiveComponentIterator
  • NServiceLocator
  • NSmartCachingIterator
  • NString
  • NTools

Interfaces

  • IComponent
  • IComponentContainer
  • IDebuggable
  • IServiceLocator
  • ITranslator

Exceptions

  • NAmbiguousServiceException
  • Overview
  • Package
  • Class
  • Tree
  • Other releases

Class NEnvironment

Nette environment and configuration.

Final
Package: Nette
Author: David Grudl
Located at Environment/Environment.php
Methods summary
final public
# __construct( )

Static class - cannot be instantiated.

Static class - cannot be instantiated.

public static
# setConfigurator( NConfigurator $configurator )

Sets "class behind Environment" configurator.

Sets "class behind Environment" configurator.

Parameters

$configurator
NConfigurator
public static NConfigurator
# getConfigurator( )

Gets "class behind Environment" configurator.

Gets "class behind Environment" configurator.

Returns

NConfigurator
public static
# setName( string $name )

Sets the current environment name.

Sets the current environment name.

Parameters

$name
string

Throws

InvalidStateException
public static string
# getName( )

Returns the current environment name.

Returns the current environment name.

Returns

string
public static
# setMode( string $mode, boolean $value = TRUE )

Sets the mode.

Sets the mode.

Parameters

$mode
string
mode identifier
$value
boolean
set or unset
public static boolean
# getMode( string $mode )

Returns the mode.

Returns the mode.

Parameters

$mode
string
mode identifier

Returns

boolean
public static boolean
# isConsole( )

Detects console (non-HTTP) mode.

Detects console (non-HTTP) mode.

Returns

boolean
public static boolean
# isProduction( )

Determines whether a server is running in production mode.

Determines whether a server is running in production mode.

Returns

boolean
public static
# setVariable( string $name, mixed $value, boolean $expand = TRUE )

Sets the environment variable.

Sets the environment variable.

Parameters

$name
string
$value
mixed
$expand
boolean
public static mixed
# getVariable( string $name, mixed $default = NULL )

Returns the value of an environment variable or $default if there is no element set.

Returns the value of an environment variable or $default if there is no element set.

Parameters

$name
string
$default
mixed
default value to use if key not found

Returns

mixed

Throws

InvalidStateException
public static array
# getVariables( )

Returns the all environment variables.

Returns the all environment variables.

Returns

array
public static string
# expand( string $var )

Returns expanded variable.

Returns expanded variable.

Parameters

$var
string

Returns

string

Throws

InvalidStateException
public static IServiceLocator
# getServiceLocator( )

Get initial instance of service locator.

Get initial instance of service locator.

Returns

IServiceLocator
public static object
# getService( string $name, array $options = NULL )

Gets the service object of the specified type.

Gets the service object of the specified type.

Parameters

$name
string
service name
$options
array
options in case service is not singleton

Returns

object
public static
# setServiceAlias( string $service, string $alias )

Adds new NEnvironment::get<Service>() method.

Adds new NEnvironment::get<Service>() method.

Parameters

$service
string
service name
$alias
string
alias name
public static object
# __callStatic( string $name, array $args )

Calling to undefined static method.

Calling to undefined static method.

Parameters

$name
string
method name
$args
array
arguments

Returns

object
service
public static NHttpRequest
# getHttpRequest( )

Returns

NHttpRequest
public static NHttpContext
# getHttpContext( )

Returns

NHttpContext
public static NHttpResponse
# getHttpResponse( )

Returns

NHttpResponse
public static NApplication
# getApplication( )

Returns

NApplication
public static NUser
# getUser( )

Returns

NUser
public static NCache
# getCache( string $namespace = '' )

Parameters

$namespace
string

Returns

NCache
public static NSession
# getSession( string $namespace = NULL )

Returns instance of session or session namespace.

Returns instance of session or session namespace.

Parameters

$namespace
string

Returns

NSession
public static ArrayObject
# loadConfig( string|NConfig $file = NULL )

Loads global configuration from file and process it.

Loads global configuration from file and process it.

Parameters

$file
string|NConfig
file name or Config object

Returns

ArrayObject
public static mixed
# getConfig( string $key = NULL, mixed $default = NULL )

Returns the global configuration.

Returns the global configuration.

Parameters

$key
string
key
$default
mixed
default value

Returns

mixed
public static
# enterCriticalSection( string $key )

Enters the critical section, other threads are locked out.

Enters the critical section, other threads are locked out.

Parameters

$key
string
public static
# leaveCriticalSection( string $key )

Leaves the critical section, other threads can now enter it.

Leaves the critical section, other threads can now enter it.

Parameters

$key
string
Constants summary
string DEVELOPMENT 'development'
#

environment name

environment name

string PRODUCTION 'production'
#
string CONSOLE 'console'
#
string LAB 'lab'
#
string DEBUG 'debug'
#

mode name

mode name

string PERFORMANCE 'performance'
#
Nette Framework 0.9.7 (for PHP 5.2) API documentation generated by ApiGen 2.3.0