diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Component.php | 2 | ||||
-rw-r--r-- | src/Core.php | 9 | ||||
-rw-r--r-- | src/Lexer.php | 3 | ||||
-rw-r--r-- | src/Parser.php | 3 | ||||
-rw-r--r-- | src/common.php | 11 |
5 files changed, 11 insertions, 17 deletions
diff --git a/src/Component.php b/src/Component.php index 08720cf..4210706 100644 --- a/src/Component.php +++ b/src/Component.php @@ -12,8 +12,6 @@ */ namespace SqlParser; -require_once 'common.php'; - /** * A component (of a statement) is a part of a statement that is common to * multiple query types. diff --git a/src/Core.php b/src/Core.php index ecca4dc..80fd5ba 100644 --- a/src/Core.php +++ b/src/Core.php @@ -7,6 +7,7 @@ */ namespace SqlParser; +use MoTranslator; class Core { @@ -34,6 +35,14 @@ class Core public $errors = array(); /** + * Constructor. + */ + public function __construct() + { + MoTranslator\Loader::load_functions(); + } + + /** * Creates a new error log. * * @param Exception $error The error exception. diff --git a/src/Lexer.php b/src/Lexer.php index 1a706d2..3a37fb1 100644 --- a/src/Lexer.php +++ b/src/Lexer.php @@ -11,8 +11,6 @@ */ namespace SqlParser; -require_once 'common.php'; - use SqlParser\Exceptions\LexerException; if (!defined('USE_UTF_STRINGS')) { @@ -162,6 +160,7 @@ class Lexer extends Core */ public function __construct($str, $strict = false, $delimiter = null) { + parent::__construct(); // `strlen` is used instead of `mb_strlen` because the lexer needs to // parse each byte of the input. $len = ($str instanceof UtfString) ? $str->length() : strlen($str); diff --git a/src/Parser.php b/src/Parser.php index b18b02d..d3698f6 100644 --- a/src/Parser.php +++ b/src/Parser.php @@ -9,8 +9,6 @@ */ namespace SqlParser; -require_once 'common.php'; - use SqlParser\Exceptions\ParserException; use SqlParser\Statements\SelectStatement; use SqlParser\Statements\TransactionStatement; @@ -340,6 +338,7 @@ class Parser extends Core */ public function __construct($list = null, $strict = false) { + parent::__construct(); if ((is_string($list)) || ($list instanceof UtfString)) { $lexer = new Lexer($list, $strict); $this->list = $lexer->list; diff --git a/src/common.php b/src/common.php deleted file mode 100644 index 94b248c..0000000 --- a/src/common.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php - -/** - * Defines common elements used by the library. - * - * @package SqlParser - */ - -if (!function_exists('__')) { - MoTranslator\Loader::load_functions(); -} |