Namespaces

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

Classes

  • ArrayTools
  • Callback
  • Component
  • ComponentContainer
  • Configurator
  • DateTime
  • Debug
  • Environment
  • Framework
  • FreezableObject
  • GenericRecursiveIterator
  • Image
  • ImageMagick
  • InstanceFilterIterator
  • Object
  • ObjectMixin
  • Paginator
  • RecursiveComponentIterator
  • ServiceLocator
  • SmartCachingIterator
  • String
  • Tools

Interfaces

  • IComponent
  • IComponentContainer
  • IDebuggable
  • IServiceLocator
  • ITranslator

Exceptions

  • AmbiguousServiceException
  • Overview
  • Namespace
  • Class
  • Tree
  • Other releases

Class Environment

Nette environment and configuration.

Final
Namespace: 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( Nette\Configurator $configurator )

Sets "class behind Environment" configurator.

Sets "class behind Environment" configurator.

Parameters

$configurator
Nette\Configurator
public static Nette\Configurator
# getConfigurator( )

Gets "class behind Environment" configurator.

Gets "class behind Environment" configurator.

Returns

Nette\Configurator
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 Nette\IServiceLocator
# getServiceLocator( )

Get initial instance of service locator.

Get initial instance of service locator.

Returns

Nette\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 Environment::get<Service>() method.

Adds new Environment::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 Nette\Web\HttpRequest
# getHttpRequest( )

Returns

Nette\Web\HttpRequest
public static Nette\Web\HttpContext
# getHttpContext( )

Returns

Nette\Web\HttpContext
public static Nette\Web\HttpResponse
# getHttpResponse( )

Returns

Nette\Web\HttpResponse
public static Nette\Application\Application
# getApplication( )

Returns

Nette\Application\Application
public static Nette\Web\User
# getUser( )

Returns

Nette\Web\User
public static Nette\Caching\Cache
# getCache( string $namespace = '' )

Parameters

$namespace
string

Returns

Nette\Caching\Cache
public static Nette\Web\Session
# getSession( string $namespace = NULL )

Returns instance of session or session namespace.

Returns instance of session or session namespace.

Parameters

$namespace
string

Returns

Nette\Web\Session
public static ArrayObject
# loadConfig( string|Nette\Config\Config $file = NULL )

Loads global configuration from file and process it.

Loads global configuration from file and process it.

Parameters

$file
string|Nette\Config\Config
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 API documentation generated by ApiGen 2.3.0