for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace League\Plates\Template\Query;
use League\Plates;
/** Stores template queries with data associated with the given query */
final class QueryStore
{
private $match_query;
private $items;
public function __construct(MatchQuery $match_query) {
$this->match_query = $match_query;
$this->items = [];
}
public function add($query, $data) {
$this->items[] = [$query, $data];
/** return all of the queries + data tuples that match the given template */
public function resolve(Plates\Template $template) {
$items = array_filter($this->items, function($tup) use ($template) {
list($query, $data) = $tup;
$data
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();
return $this->match_query->matchQuery($query, $template);
});
return array_map($items, function($tup) { return $tup[1]; });
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
$aand$care used. There was no need to assign$b.Instead, the list call could have been.