for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace database;
use database\DB;
/**
* Class Read
* @package src
*/
class Read
{
* @var
private $db;
$db
private $table;
private $read;
private $statement;
private $terms;
private $query;
private $limit;
$limit
private $offset;
$offset
private $page;
$page
private $link;
$link
private $rows;
private $maxLinks;
$maxLinks
private $first;
$first
private $last;
$last
private $paginator;
$paginator
private $result;
* Read constructor.
public function __construct()
}
* @return mixed
public function getResult()
return $this->result;
* @param $table
* @param null $parse
$parse
null
* @return array
public function query(string $query, string $parse = null)
if ($parse) {
parse_str($parse, $this->statement);
$this->query = $query;
$this->read = DB::connect()->prepare($this->query);
$this->read->execute($this->statement);
$this->rows = $this->read->rowCount();
$this->result = $this->read->fetchAll(\PDO::FETCH_OBJ);
return $this;
return $this
database\Read
array
* @return $this
public function all($table)
$this->table = (string)$table;
$this->read = DB::connect()->prepare("SELECT * FROM {$this->table}");
$this->read->execute();
return $this->result = $this->read->fetchAll(\PDO::FETCH_OBJ);
return $this->result = $...etchAll(PDO::FETCH_OBJ)
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
* @param string $table
* @param string $terms
* @param string $parse
public function find(string $table, string $terms, string $parse)
$this->table = $table;
$this->terms = $terms;
try {
$this->read = DB::connect()->prepare("SELECT * FROM {$this->table} {$this->terms}");
} catch (\PDOException $e) {
echo $e->getMessage() . " in " . $e->getFile();
* @return int
public function getRowCount()
return $this->rows;