Constructor

@param int $flags The error flag for the template engine, must be one of the
class `_ERRORS` constants
484170
protected function init($flags = TemplateEngine::NO_ERRORS)
    {
        Config::load('Assets\Composer\TemplateEngineConfig');
        $this->setFlags($flags);
        $this->template = new Template;
        $this->view = new View;
        $this->registry = new Registry;
        $this->setPageLayout(self::$default_page_layout);
    }
918765
public function hasFlag($flags)
    {
        $mask = $this->getMaskFromFlags($flags);

        return ($this->bitmask & $mask) === $mask;
    }
74247
public function setDebug($flag = true)
    {
        $this->debug = $this->getSession()->debug = (bool) $flag;
        if (true == $this->debug) {
            if (isset($this->options['debugOptions'])
                && is_array($this->options['debugOptions'])) {
                    $this->initializeOptions($this->options['debugOptions']);
                }
        } else {
            $this->initializeOptions($this->options);
        }
    }
1362973
public function number($flags = 0)
    {
        $ret = false;

        if ($number = $this->match(TextTokenizer::NUMBER, $matches, $flags)) {
            $ret = $number;
        }

        return $ret;
    }
424641
public function init($namespace) {
		// extract template path from class namespace
		$namespace = trim($namespace, '\\');
		$namespace_array = explode('\\', $namespace);
		$this->template_path = implode('/', array_slice($namespace_array, 1, 2));
		$this->template_path .= '/templates/';

		// get template name from template router
		$this->template = call_user_func(Factory::load('Config')->get('router.template'), $namespace);

		// pass the page variables to the template
		$this->setContent('page', Factory::load('Page')->get(), true);

		// cerate template compile path fron namespace array
		$module_name = implode('/', array_slice($namespace_array, 2, 1));
		$this->compile_path = STORAGE_PATH .'serpent_templates_compiled/' . $module_name . '/';
	}
104223
private function init(int $locks)
    {
        $locks = (int) $locks;
        if ($locks < 1) {
            $locks = 1;
        }

        $this->semaphore = new Internal\Semaphore($locks);
        $this->maxLocks = $locks;
    }
39317
private static function setErrors($errors) {

        $std_rpc_errors = array(
            -32700 => "Parse error",
            -32701 => "Parse error - Unsupported encoding",
            -32702 => "Parse error - Invalid character for encoding",
            -32600 => "Invalid Request",
            -32601 => "Method not found",
            -32602 => "Invalid params",
            -32603 => "Internal error",
            -32500 => "Application error",
            -32400 => "System error",
            -32300 => "Transport error",
            // Predefined Comodojo Errors
            -31000 => "Multicall is available only in XMLRPC",
            -31001 => "Recursive system.multicall forbidden"
        );

        foreach ( $std_rpc_errors as $code => $message ) {

            $errors->add($code, $message);

        }

    }
1280546
public function setFlags($flags)
    {
        if (!is_int($flags)) {
            throw new InvalidArgumentException('integer', 0);
        }

        if (($flags & FORCE_USE_PROC_OPEN) && ($flags & FORCE_USE_EXEC)) {
            throw new DomainException("Invalid flags: FORCE_USE_PROC_OPEN and FORCE_USE_EXEC cannot be set at the same time");
        }

        $this->flags = $flags;

        return $this;
    }
1235832
protected function compile()
	{
		parent::compile();

		if($GLOBALS['TL_CONFIG']['subcolumns'] == 'bootstrap_customizable')
		{
			$container =  ColumnSet::prepareContainer($this->columnset_id);

			if($container) {
				$this->Template->column = $container[$this->sc_sortid][0] . ' col_' . ($this->sc_sortid+1) . (($this->sc_sortid == count($container)-1) ? ' last' : '');
			}
		}
	}
1334323
public function createInstruction(InputDescriptor $input, TemplateInterface $template, array $flags = [])
    {
        if (!$template->getManaged()) {
            return null;
        }

        $cacheItem = $this->cacheManager->findByTemplateAndFile($template->getKey(), $input->getFileId(), $input->getFileVersion());

        if (in_array(Batch::FILTER_ERROR, $flags) && $cacheItem && !$this->isError($cacheItem)) {
            $this->logger->info('Skipping non-error item');

            return null;
        }

        if (in_array(Batch::FILTER_MISSING, $flags) && $cacheItem && !$this->isMissing($cacheItem)) {
            $this->logger->info('Skipping non-missing item');

            return null;
        }

        if (in_array(Batch::FILTER_UNCACHED, $flags) && $cacheItem && $this->isCached($cacheItem)) {
            $this->logger->info('Skipping cached item');

            return null;
        }

        if (!$cacheItem) {
            $cacheItem = new CacheItem();
            $cacheItem
                ->setId($this->cacheIdStrategy->createCacheId($template, $input))
                ->setVolumeId($input->getVolumeId())
                ->setFileId($input->getFileId())
                ->setFileVersion($input->getFileVersion())
                ->setTemplateKey($template->getKey())
                ->setTemplateRevision($template->getRevision())
                ->setCacheStatus(CacheItem::STATUS_WAITING)
                ->setQueueStatus(CacheItem::QUEUE_WAITING)
                ->setCreatedAt(new \DateTime());
        }

        $cacheItem
            ->setQueuedAt(new \DateTime());

        return new Instruction($input, $template, $cacheItem);
    }
1059888
protected function buildOptions($flags)
    {
        // Return if already built
        if (is_string($flags)) {
            return $flags;
        }

        // Build flags
        $options = [];
        $flags = $flags ? $this->sanitizeFlags($flags) : [];
        foreach ($flags as $flag => $value) {
            if (is_array($value)) {
                foreach ($value as $v) {
                    $options[] = $flag.'="'.$v.'"';
                }
            } else {
                if (is_numeric($flag)) {
                    $flag = $value;
                    $value = null;
                }

                $options[] = $value ? $flag.'="'.$value.'"' : $flag;
            }
        }

        return implode(' ', $options);
    }
1113969
public function setExtractFlags($flag)
    {
        switch ($flag) {
            case self::EXTR_DATA:
            case self::EXTR_PRIORITY:
            case self::EXTR_BOTH:
                $this->extractFlag = $flag;
                break;
            default:
                throw new Exception\InvalidArgumentException("The extract flag specified is not valid");
        }
    }
627545
public function add(...$flags)
    {
        foreach ($flags as $flag) {
            if (!$this->has($flag)) {
                $this->flags = $this->flags | (int)$flag;
            }
        }

        return $this;
    }
1320143
public function updateStatusFlags(&$flags)
    {
        if ($value = $this->owner->getNumberBadgeValue()) {
            
            $text = sprintf($this->owner->getNumberBadgeText(), $value);
            
            $flags['number-badge'] = ['text' => $text, 'title' => $text];
            $flags['number-badge-value'] = ['text' => '', 'title' => $value];
            
        }
    }
623118
public function create()
	{
		$out	= $this->template;																	//  local copy of set template
		$out	= $this->loadNestedTemplates( $out );												//  search for nested templates and load them
		
		foreach( $this->plugins as $plugin )
			if( $plugin->type == 'pre' )
				$out	= $plugin->work( $out );

 		$out	= preg_replace( '/<%--.*--%>/sU', '', $out );										//  remove template engine style comments
 		if( self::$removeComments )																	//  HTML comments should be removed
			$out	= preg_replace( '/<!--.+-->/sU', '', $out );									//  find and remove all HTML comments 
 		if( self::$removeOptional )																	//  optional parts should be removed
			$out	= preg_replace( '/<%\?--.+--%>/sU', '', $out );									//  find and remove optional parts
		else																						//  otherwise
			$out	= preg_replace( '/<%\?--(.+)--%>/sU', '\\1', $out );							//  find, remove markup but keep content

		foreach( $this->elements as $label => $element )											//  iterate over all registered element containers
		{
			$tmp = '';																				//  
			if( is_object( $element ) )																//  element is an object
			{
				if( !( $element instanceof $this->className ) )										//  object is not an template of this template engine
					continue;																		//  skip this one
				$element = $element->create();														//  render template before concat
			}
			$tmp	.= $element;
			$out	= preg_replace( '/<%(\?)?' . preg_quote( $label, '/' ) . '%>/', $tmp, $out );	//  find placeholder and set in content
 		}
		$out = preg_replace( '/<%\?.*%>/U', '', $out );    											//  remove left over optional placeholders
#        $out = preg_replace( '/\n\s+\n/', "\n", $out );												//  remove double line breaks

		foreach( $this->plugins as $plugin )
			if( $plugin->type == 'post' )
				$out	= $plugin->work( $out );

		$tags = array();																			//  create container for left over placeholders
		if( preg_match_all( '/<%.*%>/U', $out, $tags ) === 0 )										//  no more placeholders left over
		    return $out; 																			//  return final result

		$tags	= array_shift( $tags );																//  
		foreach( $tags as $key => $value )
			$tags[$key]	= preg_replace( '@(<%\??)|%>@', "", $value );
		if( $this->fileName )
			throw new Exception_Template( Exception_Template::FILE_LABELS_MISSING, $this->fileName, $tags );
		throw new Exception_Template( Exception_Template::LABELS_MISSING, NULL, $tags );
	}
963086
static function from ($path, $flags = 4096)
  {
    try {
      return new static (new FilesystemIterator($path, $flags));
    }
    catch (\Exception $e) {
      // Convert UnexpectedValueException to another type to prevent problems with some error handlers.
      throw new \InvalidArgumentException($e->getMessage ());
    }
  }
859870
public static function initializeErrorHandling(Bootstrap $bootstrap)
    {
        $configurationManager = $bootstrap->getEarlyInstance(ConfigurationManager::class);
        $settings = $configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Neos.Flow');

        $errorHandler = new ErrorHandler();
        $errorHandler->setExceptionalErrors($settings['error']['errorHandler']['exceptionalErrors']);
        $exceptionHandler = class_exists($settings['error']['exceptionHandler']['className']) ? new $settings['error']['exceptionHandler']['className'] : new ProductionExceptionHandler();
        if (is_callable([$exceptionHandler, 'injectSystemLogger'])) {
            $exceptionHandler->injectSystemLogger($bootstrap->getEarlyInstance(SystemLoggerInterface::class));
        }

        if (is_callable([$exceptionHandler, 'injectLogger'])) {
            $exceptionHandler->injectLogger($bootstrap->getEarlyInstance(PsrLoggerFactoryInterface::class)->get('systemLogger'));
        }

        if (is_callable([$exceptionHandler, 'injectThrowableStorage'])) {
            $exceptionHandler->injectThrowableStorage($bootstrap->getEarlyInstance(ThrowableStorageInterface::class));
        }

        $exceptionHandler->setOptions($settings['error']['exceptionHandler']);
    }