Инициализация ядра

Этот метод:
1. устанавливает временную зону;
2. регистрирует {@link initExceptionHandling() перехватчики ошибок}.

@return void

@since 3.00
760320
public static function init()
    {
        /* Разрешаем только однократный вызов этого метода */
        if (self::$inited)
        {
            return;
        }

        // Устанавливаем кодировку по умолчанию для операций mb_*
        mb_internal_encoding('utf-8');

        /* Предотвращает появление ошибок, связанных с неустановленной временной зоной */
        @$timezone = date_default_timezone_get();
        date_default_timezone_set($timezone);

        self::initExceptionHandling();

        self::$inited = true;
    }
740850
protected function init()
    {
        if (true===$this->isInited) {
            return;
        }

        $this->_cleanFilesStack();

        if (empty($this->__adapter_type)) {
            $this->_guessAdapterType();
        }

        if (!empty($this->__adapter_type)) {
            if (class_exists($this->__adapter_type)) {
                $this->__adapter = new $this->__adapter_type;
                if (!($this->__adapter instanceof AbstractCompressorAdapter)) {
                    throw new \LogicException(
                        sprintf('Compressor adapter must extend class "%s" (having object "%s")!', "Assets\AbstractCompressorAdapter", $this->__adapter_type)
                    );
                }
            } else {
                throw new \RuntimeException(
                    sprintf('Compressor adapter for type "%s" doesn\'t exist!', $this->__adapter_type)
                );
            }
        }

        $this->isInited = true;
    }
1034749
protected function initErrorsHandler() {
		ini_set('display_errors', false);
		error_reporting($this->errorsHandlerLevel ? : E_ALL | E_STRICT);
		$this->oldErrorsHandler = set_error_handler(array($this, 'handleError'));
		register_shutdown_function(array($this, 'checkFatalErrorOnShutDown'));
		$this->connector->registerFlushOnShutDown();
	}
990470
protected function initHaltHooks()
    {

        // error handler
        set_error_handler(function ($level, $message, $file = null, $line = null) {
            /** @var $this Application|Console */
            $event = $this->getApplicationEvent();
            $this->emit($event->setName($this::EVENT_HANDLE_ERROR), $level, $message, $file, $line);
        });

        // exception handler
        set_exception_handler(function ($exception) {
            /** @var $this Application|Console */
            /** @var \Exception|\Throwable $exception */
            // Convert throwable to exception for backwards compatibility
            if (!($exception instanceof \Exception)) {
                $throwable = $exception;
                $exception = new \ErrorException(
                    $throwable->getMessage(),
                    $throwable->getCode(),
                    E_ERROR,
                    $throwable->getFile(),
                    $throwable->getLine()
                );
            }

            $event = $this->getApplicationEvent();
            $this->emit($event->setName($this::EVENT_SYSTEM_EXCEPTION), $exception);
        });

        if (method_exists($this, 'shutdown')) {
            // shutdown function
            register_shutdown_function([$this, 'shutdown']);
        }
    }
780583
public void init(TacoTangoDevice tacoDevice, String devname, String nethost) throws DevFailed {
        Except.throw_exception("Api_TacoFailed",
                "Taco protocol not supported.\n" +
                        "Patch JTango.jar if Taco is needed.",
                "TacoTangoDeviceDAODefaultImpl.TacoTangoDeviceDAODefaultImpl(" + devname + ")");
    }
653419
public function init()
	{
		parent::init();
		if($this->name===null)
			$this->sortable=false;
		if($this->name===null && $this->value===null)
			throw new CException(Yii::t('zii','Either "name" or "value" must be specified for CDataColumn.'));
	}
405165
public function init()
    {

        // initialize the prepared statements
        $this->stockItemStmt =
            $this->getConnection()->prepare($this->loadStatement(SqlStatementKeys::STOCK_ITEM));
    }
1230115
public function init()
    {
        try
        {
            $this->data = $this->httpClientResponse->data;
        } catch (\Exception $e)
        {
            \Yii::error($this->httpClientResponse->content, self::className());

            $this->isError       = true;
            $this->errorMessage  = 'Не удалось отформатировать ответ от сервера';
            $this->errorCode     = $this->httpClientResponse->statusCode;
            $this->errorData     = $this->data;

            return;
        }

        if (!$this->httpClientResponse->isOk)
        {
            \Yii::error($this->httpClientResponse->content, self::className());

            $this->isError       = true;
            $this->errorMessage  = $this->api->getMessageByStatusCode($this->httpClientResponse->statusCode);
            $this->errorCode     = $this->httpClientResponse->statusCode;
            $this->errorData     = $this->data;

            return;
        }
    }
896170
public function handleException()
    {
        /*
        | Exception handler registered here. So it will handle all
        | exceptions and thrown as pretty format
        |-----------------------------------
        | Enable pretty exception handler and
        | do necessary configuration
        |-----------------------------------
        */
        $config = Config::get('global.config');

        $this->enable($config['logs']['activate'], $config['logs']['path'])
            ->setTitle()
            ->setDebugger(Debugger::getBlueScreen())
            ->setEmailAddress(
                $config['logs']['email'],
                $config['logs']['error.emailing']
            )->run();
    }
65872
public function init()
    {
        $this->conf = $this->getConfiguration();
        if (!isset($this->conf)) {
            throw new Exception("Adapter configuration not set, cannot initialize");
        }
        $this->adapters = array();
        foreach ($this->conf['adapters'] as $key => $adapter) {
            $adapterConf = ArrayHelper::merge($this->conf['common'], $adapter);

            $adapterConf['paymentHandler'] = $this;
            $adapterConf['adapterTag'] = $key;
            $this->adapters[$key] = \Yii::createObject($adapterConf);
        }
    }
965827
protected function initializable()
    {
        if (!$this->getParamAdapter()) {
            throw new Exception\LogicException('Param Adapter is required');
        }

        if (!$this->getSource()) {
            throw new Exception\LogicException('Source data is required');
        }

        $this->init = true;

        if (count($this->headers)) {
            $this->setHeaders($this->headers);
        }

        $this->init();

        $this->initFilters($this->getSource()->getSource());
    }
1027346
protected function initAction()
    {
        $this->action = $this->argument('action');

        if (! in_array($this->action, ['start', 'stop', 'restart', 'reload', 'infos'], true)) {
            $this->error(
                "Invalid argument '{$this->action}'. Expected 'start', 'stop', 'restart', 'reload' or 'infos'."
            );

            return;
        }
    }
277636
static function error2exception()
    {
        set_error_handler(
            function ($errno, $errstr, $errfile, $errline) {
                $r = error_reporting();
                if ($r & $errno) {
                    $exception = new \ErrorException($errstr, null, $errno,
                        $errfile, $errline);
                    if ($errno == E_USER_ERROR || $errno == E_RECOVERABLE_ERROR) {
                        throw $exception;
                    }
                    static::catchException($exception);
                }
            });
    }
717981
protected function initPresenter()
    {
        if($this->name && $this->open->isSubmitted()) {
            $this->error = $this->dataStore->getError($this->name);
        }
        $this->presenter->setElement($this);
    }
324956
public function startExceptionHandling()
    {
        $this['exception']->register($this->environment());

        //
        $debug = $this['config']['app.debug'];

        $this['exception']->setDebug($debug);
    }
1323414
public function initElements()
    {

    	$itemService = taoItems_models_classes_ItemsService::singleton();

		$fileName = '';
    	$options = array();
    	$disabledOptions = array();
    	if(isset($this->data['instance'])){
    		$item = $this->data['instance'];
    		if($item instanceof core_kernel_classes_Resource){
    			if($itemService->hasItemModel($item, array(ItemModel::MODEL_URI))){
    				$fileName = strtolower(tao_helpers_Display::textCleaner($item->getLabel()));
					try{
						$this->isInstanceValid($item);
					}catch(\common_exception_UserReadableException $e){
						$disabledOptions[$item->getUri()] = $e->getUserMessage();
					}
    				$options[$item->getUri()] = $item->getLabel();
    			}
    		}
    	}
    	else {
    		if(isset($this->data['class'])){
	    		$class = $this->data['class'];
	    	}
	    	else{
	    		$class = $itemService->getRootClass();
	    	}
    		if($class instanceof core_kernel_classes_Class){
                    $fileName =  strtolower(tao_helpers_Display::textCleaner($class->getLabel(), '*'));
                    foreach($class->getInstances(true) as $instance){
                        if($itemService->hasItemModel($instance, array(ItemModel::MODEL_URI))){
							try{
								$this->isInstanceValid($instance);
							}catch(\common_exception_UserReadableException $e){
								$disabledOptions[$instance->getUri()] = $e->getUserMessage();
							}
							$options[$instance->getUri()] = $instance->getLabel();
                        }
                    }
    		}
    	}

		$nameElt = tao_helpers_form_FormFactory::getElement('filename', 'Textbox');
		$nameElt->setDescription(__('File name'));
		$nameElt->setValue($fileName);
		$nameElt->setUnit(".zip");
		$nameElt->addValidator(tao_helpers_form_FormFactory::getValidator('NotEmpty'));
    	$this->form->addElement($nameElt);

    	$instanceElt = tao_helpers_form_FormFactory::getElement('instances', 'Checkbox');
    	$instanceElt->setDescription(__('Items'));

		if(count($options) > 1){
			$instanceElt->setAttribute('checkAll', true);
		}

		$instanceElt->setOptions(tao_helpers_Uri::encodeArray($options, tao_helpers_Uri::ENCODE_ARRAY_KEYS));
		$instanceElt->setReadOnly(tao_helpers_Uri::encodeArray($disabledOptions, tao_helpers_Uri::ENCODE_ARRAY_KEYS));
    	foreach(array_keys($options) as $value){
			if(!isset($disabledOptions[$value])){
				$instanceElt->setValue($value);
			}
		}
		$this->form->addElement($instanceElt);


    	$this->form->createGroup('options', '<h3>'.$this->getFormGroupName().'</h3>', array('filename', 'instances'));
    }
473349
public function init()
	{
		if($this->itemView===null)
			throw new CException(Yii::t('zii','The property "itemView" cannot be empty.'));
		parent::init();

		if(!isset($this->htmlOptions['class']))
			$this->htmlOptions['class']='list-view';

		if($this->baseScriptUrl===null)
			$this->baseScriptUrl=Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('zii.widgets.assets')).'/listview';

		if($this->cssFile!==false)
		{
			if($this->cssFile===null)
				$this->cssFile=$this->baseScriptUrl.'/styles.css';
			Yii::app()->getClientScript()->registerCssFile($this->cssFile);
		}
	}