Namespaces

  • Latte
    • Loaders
    • Macros
    • Runtime
  • Nette
    • Application
      • Responses
      • Routers
      • UI
    • Bridges
      • ApplicationDI
      • ApplicationLatte
      • ApplicationTracy
      • CacheDI
      • CacheLatte
      • DatabaseDI
      • DatabaseTracy
      • DITracy
      • FormsDI
      • FormsLatte
      • Framework
      • HttpDI
      • HttpTracy
      • MailDI
      • ReflectionDI
      • SecurityDI
      • SecurityTracy
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Conventions
      • Drivers
      • Table
    • DI
      • Config
        • Adapters
      • Extensions
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Loaders
    • Localization
    • Mail
    • Neon
    • PhpGenerator
      • Traits
    • Reflection
    • Security
    • Tokenizer
    • Utils
  • Tracy
    • Bridges
      • Nette
  • none

Classes

  • Compiler
  • Engine
  • Helpers
  • HtmlNode
  • MacroNode
  • MacroTokens
  • Parser
  • PhpHelpers
  • PhpWriter
  • Token
  • TokenIterator
  • Tokenizer

Interfaces

  • ILoader
  • IMacro

Traits

  • Strict

Exceptions

  • CompileException
  • RegexpException
  • RuntimeException
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Other releases
 1: <?php
 2: 
 3: /**
 4:  * This file is part of the Latte (https://latte.nette.org)
 5:  * Copyright (c) 2008 David Grudl (https://davidgrudl.com)
 6:  */
 7: 
 8: namespace Latte;
 9: 
10: 
11: /**
12:  * The exception occured during Latte compilation.
13:  */
14: class CompileException extends \Exception
15: {
16:     /** @var string */
17:     public $sourceCode;
18: 
19:     /** @var string */
20:     public $sourceName;
21: 
22:     /** @var int */
23:     public $sourceLine;
24: 
25: 
26:     public function setSource($code, $line, $name = null)
27:     {
28:         $this->sourceCode = (string) $code;
29:         $this->sourceLine = (int) $line;
30:         $this->sourceName = (string) $name;
31:         if (@is_file($name)) { // @ - may trigger error
32:             $this->message = rtrim($this->message, '.')
33:                 . ' in ' . str_replace(dirname(dirname($name)), '...', $name) . ($line ? ":$line" : '');
34:         }
35:         return $this;
36:     }
37: }
38: 
39: 
40: /**
41:  * The exception that indicates error of the last Regexp execution.
42:  */
43: class RegexpException extends \Exception
44: {
45:     public static $messages = [
46:         PREG_INTERNAL_ERROR => 'Internal error',
47:         PREG_BACKTRACK_LIMIT_ERROR => 'Backtrack limit was exhausted',
48:         PREG_RECURSION_LIMIT_ERROR => 'Recursion limit was exhausted',
49:         PREG_BAD_UTF8_ERROR => 'Malformed UTF-8 data',
50:         5 => 'Offset didn\'t correspond to the begin of a valid UTF-8 code point', // PREG_BAD_UTF8_OFFSET_ERROR
51:         6 => 'Failed due to limited JIT stack space', // PREG_JIT_STACKLIMIT_ERROR
52:     ];
53: 
54: 
55:     public function __construct($message, $code = null)
56:     {
57:         parent::__construct($message ?: (isset(self::$messages[$code]) ? self::$messages[$code] : 'Unknown error'), $code);
58:     }
59: }
60: 
61: 
62: /**
63:  * The exception that indicates error during rendering template.
64:  */
65: class RuntimeException extends \Exception
66: {
67: }
68: 
Nette 2.4-20180918 API API documentation generated by ApiGen 2.8.0