Инициализация спска разрешенных команд

@return void

@throws \OldTown\Workflow\Exception\RuntimeException
427198
protected function initAllowedCalls()
    {
        if ($this->allowedCalls) {
            $errMsg = 'Список разрешенных команд уже инициализирован';
            throw new RuntimeException($errMsg);
        }

        $this->allowedCalls = array_combine(static::$defaultAllowedCalls, static::$defaultAllowedCalls);
    }
154742
public function initialize()
    {
        if ((false === $this->exists($this->localPath)) && false === $this->filesystem->createDir($this->localPath)) {
            throw new RuntimeException(
                'Unable to create a local storage for temporary filesystem operations.'
            );
        }

        $this->initialized = true;
    }
1190906
protected function prepare(): bool
    {
        if ($this->processTitle && 'Darwin' !== \PHP_OS) {
            if (\function_exists('cli_set_process_title')) {
                \cli_set_process_title($this->processTitle);
            } elseif (\function_exists('setproctitle')) {
                \setproctitle($this->processTitle);
            }

            if ($error = \error_get_last()) {
                throw new \RuntimeException($error['message']);
            }
        }

        return $this->validateInput();
    }
1243661
protected function init()
	{
		if (isset($this->template) === false)
		{
			throw new \RuntimeException('Template property does not exist.');
		}

		if (empty($this->template) === false and is_string($this->template))
		{
			$this->template = $this->view($this->template);
		}
	}
1352848
public function doPerform()
    {
        if (!$this->mayInstall()) {
            throw new \RuntimeException('Project directory not empty.');
        }

        // Will throw exception upon error.
        $this->prepareTmpDir();

        $this->preserveEnvironment();

        try {
            parent::doPerform();
            $this->moveFiles();
        } catch (\Exception $exception) {
            $this->restoreEnvironment();
            throw new \RuntimeException('Project could not be created.', 1, $exception);
        } finally {
            $this->restoreEnvironment();
        }

        rmdir($this->tempDir);
    }
1218427
public function start()
    {
        if (!session_id() || !$this->isActive()) {
            $file = $line = null;
            if (headers_sent($file, $line)) {
                throw new \RuntimeException(sprintf('Unable to start session, output started at %s:%s', $file, $line));
            }
            session_start();
        }

        if ($this->namespace) {
            if (!isset($_SESSION[$this->namespace])) {
                $_SESSION[$this->namespace] = array();
            }
            $this->data = &$_SESSION[$this->namespace];
        } else {
            $this->data = &$_SESSION;
        }
    }
667156
protected function initializeForModelRoute()
    {
        $routeHelper = $this->getRouteHelper();

        $this->modelSlug = $routeHelper->getModelSlugForCurrentRoute();

        if ( ! $this->modelSlug) {
            throw new RuntimeException("Could not determine model slug for route in request");
        }

        $this->modelInformation = $this->getModelInformationRepository()->getByKey($this->modelSlug);

        if ( ! $this->modelInformation) {
            throw new RuntimeException(
                "Could not load information for model slug '{$this->modelSlug}' in request"
            );
        }

        return $this;
    }
673588
protected function prepare()
    {
        parent::prepare();

        if (!$this->hasBodyStream()) {
            if (false === $stream = tmpfile()) {
                throw new RuntimeException("Can't create temporary file.");
            }
            fwrite($stream, $this->getBody());
            rewind($stream);
            $this->setBody($stream);
        }

        $this->addOption('url', $this->getUrl());
        $this->addOption('upload', true);
        $this->addOption('body', $this->getBody());
    }
1001672
public function commit()
    {
        try {
            $this->storeAllTables();

            $this->snapshot = [];
        } catch (\Exception $e) {
            throw new \RuntimeException('Commit failed: ' . $e->getMessage(), 0, $e);
        }
    }
169295
public function build()
    {
        if (is_null($this->selectFields) || is_null($this->fromReportType)) {
            throw new RuntimeException('The `select()` and `from()` functions' .
                ' must be called prior to this function');
        }

        $awql = $this->buildSelectClause();
        $awql = $this->appendFromClause($awql);
        $awql = $this->appendWhereClause($awql);
        $awql = $this->appendDuringClause($awql);

        return new ReportQuery(
            $awql
        );
    }
800052
public function run()
    {
        $guard = $this->getMonitoringInputs();
        if (empty($guard)) {
            throw new \RuntimeException("Nothing to monitor ! Either configure the IDS to monitor at least one input or 
                completely deactivate this feature.");
        }
        $this->manager->run($guard);
        if ($this->manager->getImpact() > 0) {
            $data = $this->getDetectionData($this->manager->getReports());

            throw new IntrusionDetectionException($data);
        }
    }
1005141
private function checkDir() : void
    {
        $dir = dirname($this->path);
        if (!is_dir($dir)) {
            if (file_exists($dir)) {
                throw new \RuntimeException($dir . ' exists and is not a directory.');
            }
            if (!@mkdir($dir, 0755, true)) {
                throw new \RuntimeException($dir . ' does not exist and could not be created.');
            }
        }
    }
473708
public function run()
	{
		$context = $this->getContext();
		$config = $context->getConfig();
		$logger = $context->getLogger();

		$names = (array) $config->get( 'controller/common/subscription/process/processors', [] );

		$date = date( 'Y-m-d' );
		$processors = $this->getProcessors( $names );
		$manager = \Aimeos\MShop::create( $context, 'subscription' );

		$search = $manager->createSearch( true );
		$expr = [
			$search->compare( '<=', 'subscription.datenext', $date ),
			$search->combine( '||', [
				$search->compare( '==', 'subscription.dateend', null ),
				$search->compare( '>', 'subscription.dateend', $date ),
			] ),
			$search->getConditions(),
		];
		$search->setConditions( $search->combine( '&&', $expr ) );
		$search->setSortations( [$search->sort( '+', 'subscription.id' )] );

		$start = 0;

		do
		{
			$search->setSlice( $start, 100 );
			$items = $manager->searchItems( $search );

			foreach( $items as $item )
			{
				try
				{
					$context = $this->createContext( $item->getOrderBaseId() );
					$newOrder = $this->createOrderBase( $context, $item );
					$newInvoice = $this->createOrderInvoice( $context, $newOrder );

					try
					{
						$this->createPayment( $context, $newOrder, $newInvoice );

						$interval = new \DateInterval( $item->getInterval() );
						$item->setDateNext( date_create()->add( $interval )->format( 'Y-m-d' ) );
					}
					catch( \Exception $e )
					{
						$item->setReason( \Aimeos\MShop\Subscription\Item\Iface::REASON_PAYMENT );
						$item->setDateEnd( date_create()->format( 'Y-m-d' ) );
						$manager->saveItem( $item );

						throw $e;
					}

					$manager->saveItem( $item );

					foreach( $processors as $processor ) {
						$processor->renew( $item, $newInvoice );
					}
				}
				catch( \Exception $e )
				{
					$msg = 'Unable to process subscription with ID "%1$s": %2$s';
					$logger->log( sprintf( $msg, $item->getId(), $e->getMessage() ) );
					$logger->log( $e->getTraceAsString() );
				}
			}

			$count = count( $items );
			$start += $count;
		}
		while( $count === $search->getSliceSize() );
	}
880926
protected function _createChildren() {
        if ($this->getShareResult()) {
            if (!$this->getStorage()->canAllowBlocsMemory($this->numChildren)) {
                throw new Exception\RuntimeException(
                'The current storage can provide ' . $this->numChildren . ' forks. Get a bigger storage to continue.'
                );
            }
        }

        for ($i = 0; $i < $this->numChildren; $i++) {

            $pid = pcntl_fork();

            if ($pid == -1) {
                throw new Exception\RuntimeException('Fork error in the children create');
            } else if ($pid == 0) {
                $this->uid = $i + 1;
                $this->pid = getmypid();
                $this->runJob();
                break;
            } else {
                $this->handlers[$i + 1] = $pid;
            }
        }

        if ($this->isForkParent()) {
            $this->registerTimeout();
            $this->uid = 0;
            $this->pid = getmypid();
            declare(ticks = 1);
            pcntl_signal(SIGINT, array($this, 'handler'));
        }
    }
399126
public function run()
    {
        // why I put it here because you can override the implementation
        require_once dirname(__FILE__).'/../functions.php';

        if ($this->isRunning) {
            return;
        }

        $this->isRunning = true;

        $this->add(new \Bono\Middleware\CommonHandlerMiddleware());

        $this->slimRun();
    }
290818
protected function initialize()
    {
        $command = $this->client->createCommand('MULTI');

        $this->client->executeCommand($command, function ($response) {
            if (false === $response) {
                throw new RuntimeException('Could not initialize a MULTI / EXEC transaction');
            }
        });
    }
992718
public function execute()
	{
		$this->connect();

		if (!is_resource($this->connection))
		{
			$this->log(
				Log\LogLevel::ERROR,
				'Database query failed (error #{code}): {message}',
				array('code' => $this->errorNum, 'message' => $this->errorMsg)
			);
			throw new \RuntimeException($this->errorMsg, $this->errorNum);
		}

		// Take a local copy so that we don't modify the original query and cause issues later
		$sql = $this->replacePrefix((string) $this->sql);

		if ($this->limit > 0 || $this->offset > 0)
		{
			$sql = $this->limit($sql, $this->limit, $this->offset);
		}

		// Increment the query counter.
		$this->count++;

		// If debugging is enabled then let's log the query.
		if ($this->debug)
		{
			// Add the query to the object queue.
			$this->log(
				Log\LogLevel::DEBUG,
				'{sql}',
				array('sql' => $sql, 'category' => 'databasequery', 'trace' => debug_backtrace())
			);
		}

		// Reset the error values.
		$this->errorNum = 0;
		$this->errorMsg = '';

		// SQLSrv_num_rows requires a static or keyset cursor.
		if (strncmp(ltrim(strtoupper($sql)), 'SELECT', strlen('SELECT')) == 0)
		{
			$array = array('Scrollable' => SQLSRV_CURSOR_KEYSET);
		}
		else
		{
			$array = array();
		}

		// Execute the query. Error suppression is used here to prevent warnings/notices that the connection has been lost.
		$this->cursor = @sqlsrv_query($this->connection, $sql, array(), $array);

		// If an error occurred handle it.
		if (!$this->cursor)
		{
			// Check if the server was disconnected.
			if (!$this->connected())
			{
				try
				{
					// Attempt to reconnect.
					$this->connection = null;
					$this->connect();
				}
				catch (\RuntimeException $e)
				// If connect fails, ignore that exception and throw the normal exception.
				{
					// Get the error number and message.
					$errors = sqlsrv_errors();
					$this->errorNum = $errors[0]['SQLSTATE'];
					$this->errorMsg = $errors[0]['message'] . 'SQL=' . $sql;

					// Throw the normal query exception.
					$this->log(
						Log\LogLevel::ERROR,
						'Database query failed (error #{code}): {message}',
						array('code' => $this->errorNum, 'message' => $this->errorMsg)
					);
					throw new \RuntimeException($this->errorMsg, $this->errorNum);
				}

				// Since we were able to reconnect, run the query again.
				return $this->execute();
			}
			else
			// The server was not disconnected.
			{
				// Get the error number and message.
				$errors = sqlsrv_errors();
				$this->errorNum = $errors[0]['SQLSTATE'];
				$this->errorMsg = $errors[0]['message'] . 'SQL=' . $sql;

				// Throw the normal query exception.
				$this->log(
					Log\LogLevel::ERROR,
					'Database query failed (error #{code}): {message}',
					array('code' => $this->errorNum, 'message' => $this->errorMsg)
				);
				throw new \RuntimeException($this->errorMsg, $this->errorNum);
			}
		}

		return $this->cursor;
	}