for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file is part of Phuria SQL Builder package.
*
* Copyright (c) 2016 Beniamin Jonatan Šimko
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Phuria\QueryBuilder\Parser;
use Phuria\QueryBuilder\ReferenceManager;
use Phuria\QueryBuilder\Table\AbstractTable;
* @author Beniamin Jonatan Šimko <[email protected]>
class ReferenceParser
{
* @param $rawSQL
* @param ReferenceManager $manager
public function __construct($rawSQL, ReferenceManager $manager)
$this->rawSQL = $rawSQL;
rawSQL
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
$this->manager = $manager;
manager
}
* @return string
public function parseSQL()
$references = $this->manager->all();
foreach ($references as &$value) {
if ($value instanceof AbstractTable) {
$value = $value->getAliasOrName();
return str_replace(array_keys($references), array_values($references), $this->rawSQL);
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: