for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace AsyncPHP\Icicle\Database;
use Icicle\Coroutine;
use Icicle\Promise\PromiseInterface;
final class Manager
{
/**
* @var Connector
*/
private $connector;
* @var Builder
private $builder;
* @param Connector $connector
* @param Builder $builder
public function __construct(Connector $connector, Builder $builder)
$this->connector = $connector;
$this->builder = $builder;
}
* @param string $method
* @param array $parameters
*
* @return mixed
public function __call($method, array $parameters = [])
$builder = call_user_func_array([$this->builder, $method], $parameters);
$clone = clone $this;
$clone->builder = $builder;
return $clone;
* @return PromiseInterface
public function get()
return Coroutine\create(function () {
list($statement, $bindings) = $this->builder->build();
$bindings
list($first,,$third)
This checks looks for assignemnts to variables using the list(...) function, where not all assigned variables are subsequently used.
list(...)
Consider the following code example.
<?php function returnThreeValues() { return array('a', 'b', 'c'); } list($a, $b, $c) = returnThreeValues(); print $a . " - " . $c;
Only the variables $a and $c are used. There was no need to assign $b.
$a
$c
$b
Instead, the list call could have been.
list($a,, $c) = returnThreeValues();
// TODO
yield $this->connector->query($statement);
});
public function first()
$rows = (yield $this->limit(1)->get());
if (count($rows) > 0) {
yield $rows[0];
} else {
yield [];
This checks looks for assignemnts to variables using the
list(...)
function, where not all assigned variables are subsequently used.Consider the following code example.
Only the variables
$a
and$c
are used. There was no need to assign$b
.Instead, the list call could have been.