| @@ -1,8 +1,6 @@ | ||
| 1 | 1 | <?php | 
| 2 | 2 | namespace Mouf\Database\MagicQuery\Twig; | 
| 3 | 3 | |
| 4 | -use Doctrine\DBAL\Connection; | |
| 5 | - | |
| 6 | 4 | /** | 
| 7 | 5 | * Class in charge of creating the Twig environment | 
| 8 | 6 | */ | 
| @@ -24,7 +24,6 @@ | ||
| 24 | 24 | } | 
| 25 | 25 | |
| 26 | 26 | /** | 
| 27 | - * @param string $caller | |
| 28 | 27 | */ | 
| 29 | 28 | public function isOk($parameters = null) | 
| 30 | 29 |      { | 
| @@ -29,7 +29,6 @@ | ||
| 29 | 29 | } | 
| 30 | 30 | |
| 31 | 31 | /** | 
| 32 | - * @param string $caller | |
| 33 | 32 | */ | 
| 34 | 33 | public function isOk($parameters = null) | 
| 35 | 34 |      { | 
| @@ -24,7 +24,6 @@ | ||
| 24 | 24 | } | 
| 25 | 25 | |
| 26 | 26 | /** | 
| 27 | - * @param string $caller | |
| 28 | 27 | */ | 
| 29 | 28 | public function isOk($parameters = null) | 
| 30 | 29 |      { | 
| @@ -58,7 +58,7 @@ | ||
| 58 | 58 | * | 
| 59 | 59 | * @param Connection $dbConnection | 
| 60 | 60 | * @param array $parameters | 
| 61 | - * @param number $indent | |
| 61 | + * @param integer $indent | |
| 62 | 62 | * @param int $conditionsMode | 
| 63 | 63 | * | 
| 64 | 64 | * @return string | 
| @@ -174,7 +174,7 @@ | ||
| 174 | 174 | * | 
| 175 | 175 | * @param Connection $dbConnection | 
| 176 | 176 | * @param array $parameters | 
| 177 | - * @param number $indent | |
| 177 | + * @param integer $indent | |
| 178 | 178 | * @param int $conditionsMode | 
| 179 | 179 | * | 
| 180 | 180 | * @return string | 
| @@ -635,6 +635,9 @@ discard block | ||
| 635 | 635 | }); | 
| 636 | 636 | } | 
| 637 | 637 | |
| 638 | + /** | |
| 639 | + * @param \Closure $callback | |
| 640 | + */ | |
| 638 | 641 | private static function array_map_deep($array, $callback) | 
| 639 | 642 |      { | 
| 640 | 643 | $new = array(); | 
| @@ -661,7 +664,7 @@ discard block | ||
| 661 | 664 | * @param array $parameters | 
| 662 | 665 | * @param string $delimiter | 
| 663 | 666 | * @param bool|string $wrapInBrackets | 
| 664 | - * @param int|number $indent | |
| 667 | + * @param integer $indent | |
| 665 | 668 | * @param int $conditionsMode | 
| 666 | 669 | * | 
| 667 | 670 | * @return null|string | 
| @@ -335,7 +335,7 @@ discard block | ||
| 335 | 335 |              if (!empty($subTree) && !isset($subTree[0])) { | 
| 336 | 336 | $subTree = StatementFactory::toObject($subTree); | 
| 337 | 337 |              } else { | 
| 338 | -                $subTree = array_map(function ($item) { | |
| 338 | +                $subTree = array_map(function($item) { | |
| 339 | 339 |                      if (is_array($item)) { | 
| 340 | 340 | return self::toObject($item); | 
| 341 | 341 |                      } else { | 
| @@ -365,7 +365,7 @@ discard block | ||
| 365 | 365 |              array('NOT'), | 
| 366 | 366 |              array('&&', 'AND'), | 
| 367 | 367 |              array('XOR'), | 
| 368 | -            array('||', 'OR'), ); | |
| 368 | +            array('||', 'OR'),); | |
| 369 | 369 | |
| 370 | 370 | private static $OPERATOR_TO_CLASS = array( | 
| 371 | 371 | '=' => 'SQLParser\Node\Equal', | 
| @@ -626,7 +626,7 @@ discard block | ||
| 626 | 626 |      { | 
| 627 | 627 | $instanceDescriptor = $moufManager->createInstance(get_called_class()); | 
| 628 | 628 | |
| 629 | -        return self::array_map_deep($node, function ($item) use ($moufManager) { | |
| 629 | +        return self::array_map_deep($node, function($item) use ($moufManager) { | |
| 630 | 630 |              if ($item instanceof NodeInterface) { | 
| 631 | 631 | return $item->toInstanceDescriptor($moufManager); | 
| 632 | 632 |              } else { | 
| @@ -670,7 +670,7 @@ discard block | ||
| 670 | 670 |      { | 
| 671 | 671 |          if (is_array($nodes)) { | 
| 672 | 672 | $elems = array(); | 
| 673 | -            array_walk_recursive($nodes, function ($item) use (&$elems, $dbConnection, $indent, $delimiter, $parameters, $conditionsMode) { | |
| 673 | +            array_walk_recursive($nodes, function($item) use (&$elems, $dbConnection, $indent, $delimiter, $parameters, $conditionsMode) { | |
| 674 | 674 |                  if ($item instanceof SqlRenderInterface) { | 
| 675 | 675 | $itemSql = $item->toSql($parameters, $dbConnection, $indent, $conditionsMode); | 
| 676 | 676 |                      if ($itemSql !== null) { | 
| @@ -181,7 +181,7 @@ | ||
| 181 | 181 | * | 
| 182 | 182 | * @param Connection $dbConnection | 
| 183 | 183 | * @param array $parameters | 
| 184 | - * @param number $indent | |
| 184 | + * @param integer $indent | |
| 185 | 185 | * @param int $conditionsMode | 
| 186 | 186 | * | 
| 187 | 187 | * @return string | 
| @@ -39,7 +39,6 @@ | ||
| 39 | 39 | use SQLParser\Query\Select; | 
| 40 | 40 | use Mouf\MoufInstanceDescriptor; | 
| 41 | 41 | use Mouf\MoufManager; | 
| 42 | -use SQLParser\SqlRenderInterface; | |
| 43 | 42 | |
| 44 | 43 | /** | 
| 45 | 44 | * This class represents a subquery (and optionally a JOIN .. ON expression in an SQL expression. | 
| @@ -57,6 +57,9 @@ discard block | ||
| 57 | 57 | $this->allTables = array(); | 
| 58 | 58 | } | 
| 59 | 59 | |
| 60 | + /** | |
| 61 | + * @param string $txt | |
| 62 | + */ | |
| 60 | 63 | public static function dbgprint($txt) | 
| 61 | 64 |      { | 
| 62 | 65 |          if (isset($_ENV['DEBUG'])) { | 
| @@ -95,6 +98,9 @@ discard block | ||
| 95 | 98 | return 'DELETE'; | 
| 96 | 99 | } | 
| 97 | 100 | |
| 101 | + /** | |
| 102 | + * @param string $column | |
| 103 | + */ | |
| 98 | 104 | public static function getColumnNameFor($column) | 
| 99 | 105 |      { | 
| 100 | 106 |          if (strtolower($column) === 'uid') { | 
| @@ -198,6 +204,10 @@ discard block | ||
| 198 | 204 | return ($res >= 1); | 
| 199 | 205 | } | 
| 200 | 206 | |
| 207 | + /** | |
| 208 | + * @param string $table | |
| 209 | + * @param string $column | |
| 210 | + */ | |
| 201 | 211 | protected function isCLOBColumn($table, $column) | 
| 202 | 212 |      { | 
| 203 | 213 | $tables = end($this->allTables); | 
| @@ -314,6 +324,9 @@ discard block | ||
| 314 | 324 | return 'SELECT '.$sql; | 
| 315 | 325 | } | 
| 316 | 326 | |
| 327 | + /** | |
| 328 | + * @param string $sql | |
| 329 | + */ | |
| 317 | 330 | private function correctColRefStatement($sql) | 
| 318 | 331 |      { | 
| 319 | 332 | $alias = ''; | 
| @@ -368,14 +368,14 @@ | ||
| 368 | 368 |      { | 
| 369 | 369 | $k = key($parsed); | 
| 370 | 370 |          switch ($k) { | 
| 371 | - case 'USE': | |
| 372 | - # this statement is not an Oracle statement | |
| 373 | - $this->created = ''; | |
| 374 | - break; | |
| 375 | - | |
| 376 | - default: | |
| 377 | - $this->created = parent::create($parsed); | |
| 378 | - break; | |
| 371 | + case 'USE': | |
| 372 | + # this statement is not an Oracle statement | |
| 373 | + $this->created = ''; | |
| 374 | + break; | |
| 375 | + | |
| 376 | + default: | |
| 377 | + $this->created = parent::create($parsed); | |
| 378 | + break; | |
| 379 | 379 | } | 
| 380 | 380 | |
| 381 | 381 | return $this->created; |