for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
namespace Maslosoft\Manganel;
use Maslosoft\Addendum\Interfaces\AnnotatedInterface;
use Maslosoft\Mangan\Helpers\CollectionNamer;
/**
* QueryBuilder
*
* @author Piotr Maselkowski <pmaselkowski at gmail.com>
class QueryBuilder
{
* Manganel instance
* @var Manganel
private $manganel = null;
* Annotated model
* @var AnnotatedInterface
private $model;
public function __construct($model)
$this->model = $model;
$this->manganel = Manganel::create($this->model);
}
public function range($field, $start, $end = null)
$field
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
$start
$end
return $this;
public function search($q = null)
$params = [
'index' => strtolower($this->manganel->index),
'type' => CollectionNamer::nameCollection($this->model),
'body' => [
'query' => [
'query_string' => [
'query' => $q
]
];
return $this->manganel->getClient()->search($params);
* TODO Return true if search has hits
* @return boolean
* @throws Exception
public function hasHits()
throw new Exception('Not implemented');
return true;
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.
Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.
return
die
exit
function fx() { try { doSomething(); return true; } catch (\Exception $e) { return false; } return false; }
In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.
return false
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.