for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Soluble\DbWrapper\Adapter\Pdo;
use Soluble\DbWrapper\Exception;
use Soluble\DbWrapper\Adapter\AdapterInterface;
use Soluble\DbWrapper\Result\Resultset;
abstract class GenericPdo implements AdapterInterface
{
/**
* {@inheritdoc}
*/
public function execute($query)
try {
$ret = $this->resource->exec($query);
resource
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;
if ($ret === false) {
throw new Exception\InvalidArgumentException("Cannot execute [$query].");
}
} catch (Exception\InvalidArgumentException $e) {
throw $e;
} catch (\Exception $e) {
$msg = "PDOException : {$e->getMessage()} [$query]";
throw new Exception\InvalidArgumentException($msg);
public function query($query)
$stmt = $this->resource->query($query, \PDO::FETCH_ASSOC);
if ($stmt === false) {
throw new Exception\InvalidArgumentException("Query cannot be executed [$query].");
$results = new Resultset();
foreach ($stmt as $row) {
$results->append($row);
return $results;
public function quoteValue($value)
return $this->resource->quote($value);
* {@ineritdoc}
* @return \PDO
public function getResource()
return $this->resource;
abstract public function getCurrentSchema();
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: