| Code Coverage | ||||||||||
| Lines | Functions and Methods | Classes and Traits | ||||||||
| Total |  | 0.00% | 0 / 7 |  | 0.00% | 0 / 6 | CRAP |  | 0.00% | 0 / 1 | 
| tao_install_utils_SQLParser |  | 0.00% | 0 / 7 |  | 0.00% | 0 / 6 | 42 |  | 0.00% | 0 / 1 | 
| __construct |  | 0.00% | 0 / 2 |  | 0.00% | 0 / 1 | 2 | |||
| setFile |  | 0.00% | 0 / 1 |  | 0.00% | 0 / 1 | 2 | |||
| getFile |  | 0.00% | 0 / 1 |  | 0.00% | 0 / 1 | 2 | |||
| setStatements |  | 0.00% | 0 / 1 |  | 0.00% | 0 / 1 | 2 | |||
| getStatements |  | 0.00% | 0 / 1 |  | 0.00% | 0 / 1 | 2 | |||
| addStatement |  | 0.00% | 0 / 1 |  | 0.00% | 0 / 1 | 2 | |||
| 1 | <?php | 
| 2 | |
| 3 | /* | 
| 4 | * This program is free software; you can redistribute it and/or | 
| 5 | * modify it under the terms of the GNU General Public License | 
| 6 | * as published by the Free Software Foundation; under version 2 | 
| 7 | * of the License (non-upgradable). | 
| 8 | * | 
| 9 | * This program is distributed in the hope that it will be useful, | 
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 
| 12 | * GNU General Public License for more details. | 
| 13 | * | 
| 14 | * You should have received a copy of the GNU General Public License | 
| 15 | * along with this program; if not, write to the Free Software | 
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 
| 17 | * | 
| 18 | * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg | 
| 19 | * (under the project TAO & TAO2); | 
| 20 | * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung | 
| 21 | * (under the project TAO-TRANSFER); | 
| 22 | * 2009-2012 (update and modification) Public Research Centre Henri Tudor | 
| 23 | * (under the project TAO-SUSTAIN & TAO-DEV); | 
| 24 | * | 
| 25 | */ | 
| 26 | |
| 27 | /** | 
| 28 | * An abstract SQL Parser. | 
| 29 | * Concrete SQL Parser for installation should implement this class. | 
| 30 | * | 
| 31 | * @author Jerome BOGARTS <jerome.bogaerts@tudor.lu> | 
| 32 | * @package tao | 
| 33 | |
| 34 | */ | 
| 35 | abstract class tao_install_utils_SQLParser implements tao_install_utils_Parser | 
| 36 | { | 
| 37 | private $file; | 
| 38 | private $statements; | 
| 39 | |
| 40 | /** | 
| 41 | * Creates a new instance of tao_install_utils_SQLParser. | 
| 42 | */ | 
| 43 | public function __construct($file = 'unknown_path') | 
| 44 | { | 
| 45 | $this->setFile($file); | 
| 46 | $this->setStatements([]); | 
| 47 | } | 
| 48 | |
| 49 | /** | 
| 50 | * Sets the path to the SQL file that has to be parsed. | 
| 51 | * @param string $file The file path to the SQL file to parse. | 
| 52 | * @return void | 
| 53 | */ | 
| 54 | public function setFile($file) | 
| 55 | { | 
| 56 | $this->file = $file; | 
| 57 | } | 
| 58 | |
| 59 | /** | 
| 60 | * Gets the path to the SQL file that has to be parsed. | 
| 61 | * @return string The the path the SQL file that has to be parsed. | 
| 62 | */ | 
| 63 | public function getFile() | 
| 64 | { | 
| 65 | return $this->file; | 
| 66 | } | 
| 67 | |
| 68 | /** | 
| 69 | * Sets the array of string that represents the parsed SQL statements. | 
| 70 | * @param array $statements an array of SQL statements as strings. | 
| 71 | * @return void | 
| 72 | */ | 
| 73 | protected function setStatements(array $statements) | 
| 74 | { | 
| 75 | $this->statements = $statements; | 
| 76 | } | 
| 77 | |
| 78 | /** | 
| 79 | * Gets the array of SQL statements parsed by the parser. It is empty | 
| 80 | * until the first call of the parse() method or if no SQL statements | 
| 81 | * were found. | 
| 82 | * @return array an array of SQL statements as string. | 
| 83 | */ | 
| 84 | public function getStatements() | 
| 85 | { | 
| 86 | return $this->statements; | 
| 87 | } | 
| 88 | |
| 89 | /** | 
| 90 | * Adds a statement to the collection of parsed SQL statements. | 
| 91 | * @param string $statement The SQL statement to add. | 
| 92 | * @return void | 
| 93 | */ | 
| 94 | protected function addStatement($statement) | 
| 95 | { | 
| 96 | array_push($this->statements, $statement); | 
| 97 | } | 
| 98 | } |